pfitzseb / GithubMarkdown.jl

MIT License
6 stars 2 forks source link

Add a function to take a markdown string and return a string #3

Closed tlienart closed 4 years ago

tlienart commented 4 years ago

I tried

rendergfm("a **b** c")
io=IOBuffer();rendergfm(io, "a **b** c"); 

and some other sillier variants but couldn't get this to work, it seems your main entry points at the moment are files?

My use case is that in Franklin, at the moment, I'm falling back on Julia's Markdown parser for basic text (so I parse myself for stuff that Franklin uses, then whatever is left is fed in Julia's Markdown), since GithubMarkdown supports CommonMark via the relevant library, this could be much more robust (e.g. no issues with lists, reflinks etc).

I would basically need to be able to do

md_abstractstring --> rendergfm --> html_string

Thanks!

PS: tried on master as well.

pfitzseb commented 4 years ago

In the latest version you'd want

using GithubMarkdown
io = IOBuffer()
rendergfm(io, IOBuffer("a **b** c"))
String(take!(io))

I suppose I could add a

rendergfm("a **b** c") == "<p>a <strong>b</strong> c</p>"

method though.

tlienart commented 4 years ago

thanks for the quick action

pfitzseb commented 4 years ago

Alright, new version is out.