Name |
Markdown processing module |
---|---|
Backends | JVM JavaScript |
Maven coordinates | |
Compatible Ceylon release |
JVM: 1.2.x, 1.3.x (latest) JavaScript: Unknown (10/0) |
Published | Apr 1, 2018 |
Stats |
Downloads (JVM): 197 Downloads (JS): 48 Source downloads: 267 |
Description |
A port of the UsageSimilarly to value root = Parser().parse("## Hello World!"); The parse operation returns the root of a tree of parsed nodes that can be passed to one of the renderers: // Render as a String of HTML: value html = RawHtmlRenderer().render(root); // Render as a sequence of ceylon.html elements: value elements = CeylonHtmlRenderer().render(root); OptionsThe parser and renderers support options similar to those found in value parser = Parser(ParseOptions { smart = true; }); value renderer = RawHtmlRenderer(RenderOptions { defaultLanguage = "ceylon"; }); The parser supports the following options:
The renderers support the following options:
"Special" linksWhen the Here's an example of how one could transform special links: import ceylon.markdown.parser { Node, NodeType, ParseOptions, Parser, transformSpecialLinks } import ceylon.markdown.renderer { RawHtmlRenderer } Node createLinkNode(String destination, String content) { value node = Node(NodeType.link); node.destination = destination; value text = Node(NodeType.text); text.literal = content; node.appendChild(text); return node; } shared void run() { value input = "## Testing special links Broken link: [[broken]], working link: [[link]]."; value parseOptions = ParseOptions { specialLinks = true; }; value parser = Parser(parseOptions); value root = parser.parse(input); function transform(String content) => content != "broken" then createLinkNode("doc:``content``", content.uppercased); transformSpecialLinks(root, transform); value renderer = RawHtmlRenderer(); print(renderer.render(root)); } |
Dependencies |
ceylon.html/1.3.3
shared
|
Usage |
import ceylon.markdown "1.1.0"; |
Module links |
Members Imported By Code repository Issue tracker Browse Download .car Download .js Download source archive Download module documentation View API documentation |