print_markdown
Stable function · Other
Tier: stable · Kind: function · Topic: Other
| Julia | TypeScript | Python | Rust | Go |
|---|---|---|---|---|
print_markdown | printMarkdown | print_markdown | print_markdown | PrintMarkdown |
Julia
print_markdown(doc::AbstractDict)
print_markdown(doc::AbstractDict) -> String
Print an ESM document as Markdown: YAML front matter, LaTeX math in $$
displays, remark directives for components, declarations and reactions, and
fenced esm: blocks for every field without a native spelling (Lean
Source.Md.printMd).
doc is a decoded JSON document (the object load reads, e.g. from
JSON3.read). It is put in canonical form first (canonicalize_document
,
then every object’s keys sorted), so two documents that canonicalize alike
print alike, and parse_markdown(print_markdown(d)) == canonicalize_document(d).
julia> print_markdown(JSON3.read(read("model.esm", String)))
TypeScript
function printMarkdown(doc: object): string
Print an ESM document as Markdown (Source.Md.printMd).
doc is the JSON document value (plain numbers, or the NumericLiteral
leaves and bigints of losslessJsonParse). It is put in canonical form first
(canonicalizeDocument), so two documents that canonicalize alike print
alike, and parseMarkdown(printMarkdown(d)) is canonicalizeDocument(d).
Python
print_markdown(doc: dict) -> str
Print an ESM document as Markdown (Source.Md.printMd).
doc is the decoded JSON document. It is put in canonical form first
(canonicalize_document
), so two documents that
canonicalize alike print alike, and parse_markdown(print_markdown(d)) is
canonicalize_document(d).
Rust
pub fn print_markdown(doc: &Map<String, Value>) -> String
Print an ESM document as Markdown (Source.Md.printMd).
The document is put in canonical form first (canonicalize_document), so
two documents that canonicalize alike print alike, and
parse_markdown(&print_markdown(d)) is canonicalize_document(d).
Go
func PrintMarkdown(doc any) string
PrintMarkdown prints an ESM document as Markdown (Lean Source.Md.printMd).
doc is a decoded document (the value CanonicalizeDocument takes: a map
\[string\]any as encoding/json produces, numbers as float64, json.Number or int64). It is put in canonical form first, so two documents that canonicalize alike print alike, and ParseMarkdown(PrintMarkdown(d)) is CanonicalizeDocument(d).