Skip to content

madlib-lang/madmarkdown-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

madmarkdown-parser

Parser library for markdown format for madlib

How to use it

Add it to the dependencies of your madlib.json file:

{
  "dependencies": {
    "MarkdownParser": "https://github.com/madlib-lang/madmarkdown-parser/archive/refs/heads/master.zip"
  }
}

Run madlib install

import IO from "IO"
import { parseMarkdown } from "MarkdownParser"

yourMarkdown = `
# Hello World
`

where(parseMarkdown(yourMarkdown))
  is Right ast: IO.inspect(ast)
  is Left err : IO.log(err)

Run the example

madlib install
madlib run src/Example.mad

Markdown syntax currently supported

Headings

Only the hash syntax is currently supported and stops after a line return:

# Heading (h1)
## Heading (h2)
### Heading (h3)
#### Heading (h4)
##### Heading (h5)
###### Heading (h6)

Paragraphs

Paragraphs are any text that is not part of another block type and is ended by a double line return:

This is a paragraph
And here was added a line return

This is now a new paragraph

Blockquotes

Blockquotes start with a right chevron sign (>) and end after a double line return:

> This is a blockquote