cleanup, docs
This commit is contained in:
@@ -8,6 +8,7 @@ options : optional markdown options tree
|
||||
return value : rendered HTML string
|
||||
|
||||
:see
|
||||
>markup
|
||||
markdown_to_ast
|
||||
component
|
||||
component_render
|
||||
@@ -25,13 +26,6 @@ By default the function aims at a practical GitHub-flavored Markdown target, inc
|
||||
|
||||
Example:
|
||||
|
||||
```uce
|
||||
DValue options;
|
||||
options["components"][":::warning"] = "components/markdown/warning";
|
||||
options["components"]["node.code_block"] = "components/markdown/code_block";
|
||||
String html = markdown_to_html(file_get_contents("guide.md"), options);
|
||||
print(html);
|
||||
```
|
||||
|
||||
Supported syntax:
|
||||
|
||||
@@ -55,18 +49,9 @@ Options:
|
||||
|
||||
Directive hook example:
|
||||
|
||||
```uce
|
||||
options["components"][":::warning"] = "components/markdown/warning";
|
||||
```
|
||||
|
||||
Generic node hook examples:
|
||||
|
||||
```uce
|
||||
options["components"]["node.code_block"] = "components/markdown/code_block";
|
||||
options["components"]["node.table"] = "components/markdown/table";
|
||||
options["components"]["node.link"] = "components/markdown/link";
|
||||
options["components"]["node.directive"] = "components/markdown/directive";
|
||||
```
|
||||
|
||||
If both an exact directive hook and a generic `node.directive` hook exist, the exact directive hook wins.
|
||||
|
||||
@@ -89,23 +74,12 @@ Useful fields include:
|
||||
|
||||
Directive blocks use this form:
|
||||
|
||||
```md
|
||||
:::warning title="Heads up"
|
||||
Body markdown here
|
||||
:::
|
||||
```
|
||||
|
||||
The parser stores:
|
||||
|
||||
```text
|
||||
node["name"] = "warning"
|
||||
node["argument"] = ...
|
||||
node["attrs"] = ...
|
||||
```
|
||||
|
||||
That makes directive components a good fit for alerts, callouts, cards, embeds, and richer page-level Markdown extensions.
|
||||
|
||||
Related:
|
||||
|
||||
- PHP: Parsedown, League CommonMark, or similar Markdown-to-HTML renderers
|
||||
- JavaScript / Node.js: `marked`, `markdown-it`, `remark-html`, or other Markdown renderers
|
||||
:example
|
||||
print(markdown_to_html("**bold**"), "\n");
|
||||
|
||||
Reference in New Issue
Block a user