commondoc-markdown
2024-10-12
Converter from Markdown to CommonDoc.
CommonDoc-Markdown
This is a wrapper around 3BMD markdown parser which produces documents in CommonDoc format. Also, it is able to render CommonDoc documents into the Markdown.
It is a proof of the concept, but I'm already using it in the documentation builder 40ANTS-DOC.
Note. This library is not compatible with CommonMark yet.
Installation
This library available only at Ultralisp.org now. To install it using Quicklisp client, do:
(ql-dist:install-dist "http://dist.ultralisp.org/" :prompt nil) (ql:quickload :commondoc-markdown)
Parsing Markdown to CommonDoc
CL-USER> (common-doc.format:parse-document
(make-instance 'commondoc-markdown:markdown)
"
# Hello World
* First item
* Second item
")
#<COMMON-DOC:SECTION title: Hello World, ref: NIL>
Writing CommonDoc to Markdown
Now we can render our document back to Markdown:
CL-USER> (common-doc.format:emit-to-string
(make-instance 'commondoc-markdown:markdown)
*document*)
"# Hello World
* First item
* Second item
"
API
variable commondoc-markdown/emitter:*generate-short-link-references*
t
By default it is T
, but you can bind it to NIL
,
to prevent short link references generation.
variable commondoc-markdown/emitter:*min-link-hash-length*
4
Minumum length of the hash for generated markdown links.
This works only when *generate-short-link-references*
variable
is set to T
.
variable commondoc-markdown/emitter:*emit-section-anchors*
t
When this variable is T
(default), emitter outputs
a raw html <a name="some-id"></a>
before each
Markdown section.
Roadmap
- Make commondoc-markdown compatible with CommonMark syntax.