MarkdownToNotebook[source] converts a literate-markdown document (a file path,
an http(s) URL, or a raw string) into a Wolfram notebook, choosing the layout
from a Template frontmatter key. The goal is that the markdown can express
almost everything the Documentation Tools palette and the definition-notebook
docked toolbars provide, so authors never hand-edit notebook cell styles.
One source format produces:
Symbol/Guide/TechNotedocumentation pages (the authoring notebooksDocumentationBuildturns into reference/guide/tutorial pages);FunctionResource/Pacletdefinition notebooks (the official templates, with their docked Deploy / Submit / Check toolbar, publishable as-is);Defaultplain styled notebooks.
Frontmatter drives metadata; ## sections and fenced ```wl cells become the
content; example cells are evaluated and cached. A #| file: path cell inlines a
.wl file or URL.
The function is deployed publicly in the Wolfram Cloud, so you can use it without installing anything:
ResourceFunction["https://www.wolframcloud.com/obj/nikm/DeployedResources/Function/MarkdownToNotebook"]["doc.md"]Note: official publication to the Wolfram Function Repository is pending review. Until then, use the public cloud link above (or the local
MarkdownToNotebook.wl).
MarkdownToNotebook.wl- the converter.MarkdownToNotebook.md- its own Function Repository definition, authored in the very format it converts (self-hosting).build.wls- defines the function from the markdown, converts it, and publishes it.build-out.wlsregenerates the GitHub-renderable markdown twin.docs/- the markdown <-> notebook mapping, the palette/button catalog, formatting and resource-notebook references, hard-won subtleties, andupdate-screenshots.wls.examples/- worked example documents (see below).
End-to-end markdown-authored Wolfram artifacts built with MarkdownToNotebook:
examples/AccessibleColors- a complete paclet (submodule), authored entirely in markdown and published as Wolfram/AccessibleColors: a guide, four symbol pages, a tutorial, and the Paclet Repository definition.examples/IntroToQuantumComputing- a two-chapter book using the newTemplate: Chapter(Wolfram Book Tools styles): exercises with solutions, vocabulary tables, Q&A, solved examples, theorem/proof blocks, tech notes, summary, and references. Generates aContents.nb(using the WolframBookTools paclet's own inline TOC stylesheet and cell shape) plus aMaster.nbthat concatenates the chapters into one book-form notebook (mirroringWBTCreateCorrespondingPrintDirectory). Published to the cloud at:- Other markdown -> notebook samples under
examples/(AdaLovelace, BlochSphereGates, PiIsMostlyRandom, PrimeSpiralPoints, QuantumWalk, ReverseAddSequence, WallpaperGroups) - each a single notebook rendered with theDefault/Essaytemplates.
Get["MarkdownToNotebook.wl"];
MarkdownToNotebook["path/to/doc.md"] (* returns the Notebook expression *)
MarkdownToNotebook["path/to/doc.md", "doc.nb"] (* also writes doc.nb, returns the file *)See docs/README.md for the full conventions, and
GUIDE.md for the Wolfram Language coding style the .wl and
.wls sources follow.
Parsing is pure Wolfram, kept in the ## Definition cells: there is no
paclet directory and no native (C/Rust) extension. If inline-markdown
fidelity ever needs a real CommonMark parser, swap only the inline layer
(comrak via LibraryLink, or a pandoc shell-out); the block parser and the
evaluate/cache engine are unaffected. Example outputs are evaluated once
and cached as PersistentObjects keyed by a cumulative content hash of
the example cells.
The official, submittable FunctionResource definition notebook is the one
CreateNotebook["FunctionResource"] (front end) or
ResourceFunction["CreateResourceNotebook"]["Function"] (kernel) opens. Its
template is FunctionResource/Kernel/Templates/FunctionResourceDefinition.nb;
the Deploy / Submit toolbar lives in docked cells
(TemplateBox[{}, "MainGridTemplate"]) of FunctionResourceDefinitionStyles.nb,
driven by the DefinitionNotebookClient paclet. The converter fills that
template directly, so publishing stays headless.