Hacker News new | past | comments | ask | show | jobs | submit login

I sometimes use pandoc to clean up my markdown-formatted documents, especially given its abilities to "wrap" text and add indentation-style whitespace that makes plain-text documents look nearly suitable for publishing as-is (almost kinda like RFC docs but without header/footer cruft).

There are a few things (in latest version, that don't really survive round-trip from markdown back to markdown:

- reference-style links (e.g. `[foo][f]`). They are converted to inline links e.g. `[foo](http://...)`.

- setext vs hashmark headers. `foo\n=====` will get converted to `# foo`.

- markdown allows for forced-linebreak <br>s to be added with two trailing blank spaces at the end of a line. Pandoc escapes these with a trailing `\` at the end of the line.

These are only occasional nuisances, but overall the documents (at least in my experience) are not butchered.

I also occasionally go from markdown to docx for the purposes of uploading to google-docs and copy/pasting large sections into other docs. This is the only markdown-to-google-docs workflow I've found that works to preserve formatting. It's never really butchered anything, except a few times the syntax-highlighting for code-blocks gets confused and keywords get the wrong colors.

IIRC, there are CLI flags for your first two points. I think the latter is something like —atx-headers.

You can choose whether reference links go at the end of the paragraph or the document.

Applications are open for YC Winter 2020

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact