Markdown (.md)
Background
-
- Registered MIME types: text/markdown, text/x-markdown
- A markup language allowing formatting text documents.
- Plain text format.
Import & Export
- Import["file.md"] imports a Markdown file as plaintext.
- Import["file.md",elements] imports the specified elements.
- The import format can be specified with Import["file","Markdown"] or Import["file",{"Markdown",elem,…}].
- Export["file.md",expr] creates a Markdown file from expr.
- Expressions representing table data are exported as Markdown tables.
- Image and Graphics objects are converted to PNG images when exporting to Markdown.
- Supported expressions expr include:
-
nb a Notebook or NotebookObject expression text plain or styled text table a Tabular, Dataset or other table data image an Image, Graphics, Graph and other visual data video a Video, Manipulate and other dynamic visual data hyperlink a Hyperlink expression - See the following reference pages for full general information:
-
Import, Export import from or export to a file CloudImport, CloudExport import from or export to a cloud object ImportString, ExportString import from or export to a string ImportByteArray, ExportByteArray import from or export to a byte array
Import Elements
- General Import elements:
-
"Elements" list of elements and options available in this file "Summary" summary of the file "Rules" list of rules for all available elements - Data representation elements:
-
"FormattedText" a sequence of formatted text for the whole document "Hyperlinks" a list of Hyperlink objects "Images" a list of Image objects "Notebook" a Notebook expression "NotebookObject" a NotebookObject expression "Plaintext" a string giving the textual content of the whole document "Tables" a list of Tabular objects - Metadata elements:
-
"Title" document title
| ByteOrdering | Automatic | ordering of bytes | |
| CharacterEncoding | "UTF8ISOLatin1" | raw character encoding used in the file | |
| "ImportImages" | True |
| "ExpressionFormattingFunction" | Automatic | ||
| "SnippetRowCount" | Infinity | number of rows taken from the beginning and the end of table data during conversion to strings | |
| GeneratedAssetFormat | Automatic | the file format of asset files | |
| GeneratedAssetLocation | Automatic | the location of asset files | |
| "WolframLanguageTag" | "wl" | tag used for Wolfram Language code blocks |
| Automatic | automatic setting | |
| <|"Image"fmt1,"AniamtedImage"fmt2|> | ||
| "fmt" | use format "fmt" for static images |
| Automatic | automatic setting | |
| "CloudObject" | ||
| "CloudObjectPublic" | storing asset files in cloud objects with permission set to public | |
| "LocalObject" | ||
| "dir/" | storing asset files under the directory dir | |
| None | storing asset files as data URLs |
| Automatic | default conversion to string | |
| form | any form supported by Format such as InputForm | |
| f | arbitrary function that converts an expression to a string |
| Infinity | all rows are exported | |
| n | only the first n rows are exported | |
| {n} | the first and the last n rows are exported | |
| {m,n} | the first m and and the last n rows are exported |
Examples
open all close allBasic Examples (3)
Scope (10)
Import (2)
Export (8)
Export a Hyperlink expression:
Export an Image object:
Export a Video object:
Export a Tabular object:
Export a QuantityArray:
Import it back as a Tabular object:
Export a Notebook expression including item cells:
Import a notebook file as a NotebookObject:
Import Elements (9)
Import Options (3)
CharacterEncoding (1)
The character encoding can be set to any value from $CharacterEncodings:
"ImportImages" (2)
Export Options (10)
"ExpressionFormattingFunction" (1)
GeneratedAssetFormat (2)
By default, static images are exported as "PNG":
Specify different format for static images:
By default, animated images, Video and Manipulate objects are exported as "WebP":
GeneratedAssetLocation (5)
Assets are automatically generated in the "img" folder in the same directory as the .md file:
Store each asset as a LocalObject:
Store each asset as a CloudObject with permission set to private:
Store each asset as a CloudObject with permission set to public: