Liking cljdoc? Tell your friends :D

nextjournal.markdown.parser

Deals with transforming a collection of markdown-it tokens obtained from parsing markdown text into an AST composed of nested clojure structures.

See parse function.

A "Node" has the following keys:

  • type: a Node's type as keyword (:heading, :paragraph, :text, :code etc.)
  • info: (optional) fenced code info
  • content: (optional) a collection of Nodes representing nested content
  • text: (optional) content of text nodes, a collection of Nodes
  • heading-level: (on :heading nodes)
  • attrs: attributes as passed by markdownit tokens (e.g {:attrs {:style "some style info"}})
Deals with transforming a collection of markdown-it tokens obtained from parsing markdown text into an AST composed
of nested clojure structures.

See `parse` function.

A "Node" has the following keys:
- type: a Node's type as keyword (:heading, :paragraph, :text, :code etc.)
- info: (optional) fenced code info
- content: (optional) a collection of Nodes representing nested content
- text: (optional) content of text nodes, a collection of Nodes
- heading-level: (on `:heading` nodes)
- attrs: attributes as passed by markdownit tokens (e.g {:attrs {:style "some style info"}})
raw docstring

add-title+tocclj/s

(add-title+toc {:as doc :keys [content]})

Computes and adds a :title and a :toc to the document-like structure doc which might have not been constructed by means of parse.

Computes and adds a :title and a :toc to the document-like structure `doc` which might have not been constructed by means of `parse`.
raw docstring

add-to-tocclj/s

(add-to-toc doc {:as h :keys [heading-level]})

apply-tokenclj/smultimethod


apply-tokensclj/s

(apply-tokens doc tokens)

block-formulaclj/s

(block-formula text)

close-nodeclj/s

(close-node doc)

empty-docclj/s


empty-text-node?clj/s

(empty-text-node? {text :text t :type})

formulaclj/s

(formula text)

get-in*clj/s


hlevelclj/s

(hlevel {:as _token hn :tag})

inc-lastclj/s

(inc-last path)

into-tocclj/s

(into-toc toc {:as toc-item :keys [heading-level]})

nodeclj/s

(node type content attrs top-level)

open-nodeclj/s

(open-node doc type)
(open-node doc type attrs)
(open-node doc type attrs top-level)

pairs->kmapclj/s

(pairs->kmap pairs)

parseclj/s

(parse tokens)
(parse doc tokens)

Takes a doc and a collection of markdown-it tokens, applies tokens to doc. Uses an emtpy doc in arity 1.

Takes a doc and a collection of markdown-it tokens, applies tokens to doc. Uses an emtpy doc in arity 1.
raw docstring

parse-fence-infoclj/s

(parse-fence-info info-str)

Ingests nextjournal, GFM, Pandoc and RMarkdown fenced code block info, returns a map

Nextjournal

  ...

Pandoc

  ...

Rmd

  ...

See also:

Ingests nextjournal, GFM, Pandoc and RMarkdown fenced code block info, returns a map

Nextjournal
```python id=2e3541da-0735-4b7f-a12f-4fb1bfcb6138
  ...
```

Pandoc
```{#pandoc-id .languge .extra-class key=Val}
  ...
```

Rmd
```{r cars, echo=FALSE}
  ...
```

See also:
- https://github.github.com/gfm/#info-string
- https://pandoc.org/MANUAL.html#fenced-code-blocks
- https://rstudio.com/wp-content/uploads/2016/03/rmarkdown-cheatsheet-2.0.pdf
raw docstring

push-nodeclj/s

(push-node {:as doc :nextjournal.markdown.parser/keys [path]} node)

push-nodesclj/s


re-groups*clj

(re-groups* m)

re-idx-seqclj/s

(re-idx-seq re text)

Takes a regex and a string, returns a seq of triplets comprised of match groups followed by indices delimiting each match.

Takes a regex and a string, returns a seq of triplets comprised of match groups followed by indices delimiting each match.
raw docstring

section-atclj/s

(section-at {:as doc :keys [content]} [_ pos :as path])

set-title-when-missingclj/s

(set-title-when-missing {:as doc :keys [title]} heading)

sidenote-refclj/s

(sidenote-ref ref)

tag-nodeclj/s

(tag-node text)

text-nodeclj/s

(text-node text)

text-tokenizersclj/s

handler :: Match -> Node

handler :: Match -> Node
raw docstring

tokenize-textclj/s

(tokenize-text {:keys [regex handler]} text)

update*clj/s


update-currentclj/s

(update-current {:as doc path :nextjournal.markdown.parser/path} fn & args)

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close