Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/iamgio/quarkdown
Browse files Browse the repository at this point in the history
  • Loading branch information
iamgio committed Aug 24, 2024
2 parents 3990a25 + a4bf8b1 commit ad78550
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import eu.iamgio.quarkdown.ast.NestableNode
*/
interface AstIterator {
/**
* Runs the iterator from the given root node
* Runs the iterator from the given root node,
* traversing the node tree and visiting each node.
*/
fun run(root: NestableNode)
fun traverse(root: NestableNode)
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class ObservableAstIterator : AstIterator {
hook.attach(this)
}

override fun run(root: NestableNode) {
override fun traverse(root: NestableNode) {
root.flattenedChildren().forEach { node ->
hooks.forEach { hook -> hook(node) }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ open class BaseMarkdownInlineTokenRegexPatterns {
)

/**
* An image, same as a link preceeded by a `!`.
* An image, same as a link preceded by a `!`.
* As an extension, Quarkdown introduces an optional `(WxH)` to be added at the end which specifies
* the image size, where W and H can be integers or `_` (auto).
* @see ImageToken
Expand All @@ -176,7 +176,7 @@ open class BaseMarkdownInlineTokenRegexPatterns {
)

/**
* An image that references a link definition, same as a reference link preceeded by a `!`.
* An image that references a link definition, same as a reference link preceded by a `!`.
* @see ReferenceImageToken
* @see referenceLink
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class Pipeline(
private fun visitTree(document: Document) {
context.flavor.treeIteratorFactory
.default(context)
.run(document)
.traverse(document)

hooks?.afterTreeVisiting?.invoke(this)
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/test/kotlin/eu/iamgio/quarkdown/MiscTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class MiscTest {
assertEquals("java", it.language)
}
.onFinished { finished = true }
.run(node)
.traverse(node)

assertTrue(finished)
}
Expand Down
6 changes: 4 additions & 2 deletions demo/demo.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,10 @@ from your Markdown code.
## Math

.sourceresult
If we try to calculate the **surface** of a circle of **radius 8**,
we'll find out it's **.multiply {.pow {8} to:{2}} by:{.pi}**
.var {radius} {8}

If we try to calculate the **surface** of a circle of **radius .radius**,
we'll find out it's **.multiply {.pow {.radius} to:{2}} by:{.pi}**

## Scripting {#scripting-basic}

Expand Down

0 comments on commit ad78550

Please sign in to comment.