mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-03 05:08:14 +00:00
Doc lines for vendor:*
This commit is contained in:
Vendored
-6
@@ -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"
|
||||
|
||||
Vendored
+32
-45
@@ -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
|
||||
Reference in New Issue
Block a user