jgm / cheapskate

Experimental markdown processor in Haskell
BSD 3-Clause "New" or "Revised" License
107 stars 18 forks source link

Serialize `Doc` back into a `Text` value #30

Open tysonzero opened 5 years ago

tysonzero commented 5 years ago

We are sometimes using cheapskate to parse existing markdown, but other times we are using it to generate markdown of our own instead of concatenating a bunch of strings. The downside is that once you have a Doc, there doesn't seem to be a way to get the underlying Text back, for things like storing it in a database or passing it into text editors.

A render :: Doc -> Text function would be fantastic, although maybe Blocks -> Text would be more appropriate as the Options payload in Doc seems irrelevant when you aren't rendering to HTML.