Doc lines for vendor:*

This commit is contained in:
Jeroen van Rijn
2025-10-10 17:51:28 +02:00
parent 7e7b6ac0de
commit 998fbdc5c0
52 changed files with 125 additions and 105 deletions
-6
View File
@@ -1,9 +1,3 @@
/*
Bindings for [[CMark ; https://github.com/commonmark/cmark ]].
Original authors: John MacFarlane, Vicent Marti, Kārlis Gaņģis, Nick Wellnhofer.
See LICENSE for license details.
*/
package vendor_commonmark
import "core:c"
+32 -45
View File
@@ -1,18 +1,13 @@
#+build ignore
/*
Bindings for [[CMark; https://github.com/commonmark/cmark]].
Bindings for [[ CMark; https://github.com/commonmark/cmark ]].
Original authors: John MacFarlane, Vicent Marti, Kārlis Gaņģis, Nick Wellnhofer.
See LICENSE for license details.
*/
package vendor_commonmark
Original authors: John MacFarlane, Vicent Marti, Kārlis Gaņģis, Nick Wellnhofer.
See LICENSE for license details.
/*
Parsing - Simple interface:
```odin
Example:
import cm "vendor:commonmark"
// Parsing - Simple interface
hellope_world :: proc() {
fmt.printf("CMark version: %v\n", cm.version_string())
@@ -25,13 +20,8 @@ package vendor_commonmark
fmt.println(html)
}
```
Parsing - Streaming interface:
```odin
import cm "vendor:commonmark"
// Parsing - Streaming interface
streaming :: proc() {
using cm
@@ -67,26 +57,23 @@ package vendor_commonmark
fmt.println(html)
}
```
An iterator will walk through a tree of nodes, starting from a root
node, returning one node at a time, together with information about
whether the node is being entered or exited.
An iterator will walk through a tree of nodes, starting from a root
node, returning one node at a time, together with information about
whether the node is being entered or exited.
The iterator will first descend to a child node, if there is one.
When there is no child, the iterator will go to the next sibling.
When there is no next sibling, the iterator will return to the parent
(but with an `Event_Type.Exit`).
The iterator will first descend to a child node, if there is one.
When there is no child, the iterator will go to the next sibling.
When there is no next sibling, the iterator will return to the parent
(but with an `Event_Type.Exit`).
The iterator will return `.Done` when it reaches the root node again.
The iterator will return `.Done` when it reaches the root node again.
One natural application is an HTML renderer, where an `.Enter` event
outputs an open tag and an `.Exit` event outputs a close tag.
One natural application is an HTML renderer, where an `.Enter` event
outputs an open tag and an `.Exit` event outputs a close tag.
An iterator might also be used to transform an AST in some systematic
way, for example, turning all level-3 headings into regular paragraphs.
An iterator might also be used to transform an AST in some systematic
way, for example, turning all level-3 headings into regular paragraphs.
```odin
usage_example(root: ^Node) {
ev_type: Event_Type
iter := iter_new(root)
@@ -98,20 +85,20 @@ package vendor_commonmark
// Do something with `cur` and `ev_type`
}
}
```
Iterators will never return `.Exit` events for leaf nodes,
which are nodes of type:
Iterators will never return `.Exit` events for leaf nodes,
which are nodes of type:
* HTML_Block
* Thematic_Break
* Code_Block
* Text
* Soft_Break
* Line_Break
* Code
* HTML_Inline
* HTML_Block
* Thematic_Break
* Code_Block
* Text
* Soft_Break
* Line_Break
* Code
* HTML_Inline
Nodes must only be modified after an `.Exit` event, or an `.Enter` event for
leaf nodes.
*/
Nodes must only be modified after an `.Exit` event, or an `.Enter` event for
leaf nodes.
*/
package vendor_commonmark