Skip to content

erlsci/erlmd

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

erlmd

Erlang Markdown parser with HTML and AST output (erlmarkdown fork)

About

  • Original library (erlmarkdown): Focused on Markdown → HTML conversion, preserved with community improvements in the branch release/1.1.x
  • This fork (erlsci/erlmd): Added support for Markdown → AST (Abstract Syntax Tree) - release/1.2.x

Installation

Add to your rebar.config:

{deps, [
    {erlmd, "1.2.0"}
]}.

Usage

Markdown to HTML

1> erlmd:conv("# Hello *World*").
"<h1>Hello <em>World</em></h1>"

2> erlmd:conv("- Item 1\n- Item 2").
"<ul>\n<li>Item 1</li>\n<li>Item 2</li>\n</ul>"

Markdown to AST

1> AST = erlmd:conv_ast("# Hello *World*").
{document,[{header,1,
                   [{text,"Hello "},{emphasis,[{text,"World"}],42}],
                   atx}]}

2> erlmd:conv_html(AST).
"<h1>Hello <em>World</em></h1>"

% Or use the options API
3> erlmd:conv("# Hello\n\n- Item 1\n- Item 2\n\n", #{format => ast}).
{document,[{header,1,[{text,"Hello"}],atx},
           {blank_line},
           {list,ul,
                 [{list_item,[{paragraph,[{text,"Item 1"}]}],true},
                  {list_item,[{paragraph,[{text,"Item 2"}]}],true}],
                 true}]}

Documentation

License

Same as the original Markdown (BSD-style). See the Daring Fireball project for details.

About

An implementation of markdown written in Erlang

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Erlang 100.0%