lruiz/MarkdownPapers

PlainTextEmitter

Opened this issue · 13 comments

Would be very convenient if you create a PlainTextEmitter, which would produce a plain text. Sometimes this could be a useful feature.

For something like pretty print ?

For something like emails, for example. I have a markdown text which I render in web and also send by email. I want to use HTML in web and plain text in emails.

I have exactly the same requirement. I'm going to give MarkdownPapers a go for web rendering but if it had a plain text emitter too that would be excellent.

Ok, I'm going to write some initial code

Why not just "emit" the original text?

  1. because some markup, such as the notation for hyperlinks, isn't very end-user-friendly
  2. because some things, such as laying out tables, needs to be done with HTML

We wrote our own HTML emitter but it's a quick hack, just good enough for our own needs and not supporting all the features of markdown. Hopefully the code Iruiz is working on will be a proper implementation.

  1. Markdownpapers doesn't support tables. See issue #33

"HTML emitter" - might as well use the regular emitter, no?

You're right, that makes no sense, sorry - I meant to write "our own plain text emitter"..

I suppose it's all a matter of taste, but it seems as though a plain text emitter is counter to the spirit of markdown; the whole point is that the markup is supposed to look clean and legible as-is, like a hand-written plain-text email. I personally find this markup hyperlink style to be quite readable: [sample linked text] 1. I can't think of a cleaner way to represent a hyperlink in plain text than the markdown source, if you use that style with the URL set up like a footnote.

I like this idea of footnotes

In case it's not clear: the footnote style links are already supported markdown. I was just suggesting that a PlainTextEmitter isn't really necessary; instead users can just create their markup source to look how they want it to. I recommend the footnote style as the most readable links.

Well, I though PlainTextEmitter could be use as a prettyfier too, but don't know.

Footnote style links look OK as long as there aren't many of them, and the block of text they're in isn't very long. Otherwise they're a lot less readable than inline links.

The table problem is still the killer reason why we use our plain text emitter. (We have a client who has price tables which need to appear on the web and in plain text, from the same source.) This and anything else which isn't supported by Markdownpapers requires you to use HTML for the web version, which needs to be stripped out for the plain text version.

It would be nice if a plain text emitter also did prettifying like filling lines of text to a given width. Just because markdown is "human readable" doesn't mean it's necessarily "pretty".