RTF to Markdown

I work a lot with Markdown. And I know Tinderbox can e.g. through markdown-prototype display Markdown. Fine.

However, I often start quickly with a note without invoking the markdown-prototype. Those notes often contain bullet-items.

So the note grows and several other notes are added … and now it would be to tedious to go back and manually convert RTF-bullet-lists (using the List convention in Tinderbox) into bullet-lists (markdown style).

So I’d like to know of a good option to – after exporting the selected notes from Tinderbox to Finder as a RTF-file – convert RTF to markdown.

I know there are online-converters to do that and I know there is Pandoc. I would love to use pandoc … but as far as I can see, there’s no easy to handle Frontend for Pandoc.

So what do you suggest?

Nice one @PaulWalters. I like the idea of simply changing the extension. But, of course, that does not turn bullet-items (created in TBX, RTF style) into markdown-readable bullet-item, does it?

If it would, one wouldn’t even need to bother changing the extension that at least all the Markdown-Editors I know do read the Markdown content of a file no matter whether the file has either .txt or .md extension.

So: The quest goes on.

Hi @andreas … I always write in Markdown by default, even if the system I’m writing in is not “Markdown aware”. That way, I never have to worry about converting Word or RTF or whatever into MD; a simple text copy/paste is all I need.

I get it and used to do it this way, as well.

But first of: RTF is quite capable for jotting down things quick and dirty.

Hence, bullet-items start to become ugly to look at once written in a non-Markdown-Editor.

But most importantly: There are sources of doing the requested conversion.

All I am looking for is either an offline-Version of such RTF-Markdown-Convertes.

Since, one note written in markdown within Tinderbox is just fine.

But trying to use preview showing more than one note is not going to work for me.

Using RTF, however, one can easily write a whole book in tinderbox almost as good as in Scrivener, well I am about to say: in parts even better than in Scrivener. Here, I am speaking about the concatenated display of $Text-content of several selected notes.

I did @PaulWalters and so come to happen to know that it does not!

Interesting. When I export notes as plain text, with bulleted lists (using the Lists widget in the Ruler), it is!

They are recognized as markdown lists by Marked, etc. Go figure.

@PaulWalters

First of, pandoc does not convert RTF to Markdown.

Secondly, the method you described is not capable of transferring everything beyond first level bullet-list-items properly. Not even Marked2App. At least not on my end.

However, this online Rtf2markdown-converter does. Maybe you are curious enough to find out for yourself.

Anyway, thanks for your feedback.

Of course not. An interim step such as textutil to convert RTF to HTML is needed. For example.

textutil -convert html -stdout file.rtf | pandoc --from=html --to=markdown --out=file.md

I have not (nor will) tested this with RTF exported from Tinderbox.

Good @PaulWalters. Let’s end things here. Thanks for your suggestion.

I would export to HTML and run it through an HTML-to-markdown converter.

I don’t have time to write the code myself right now, but this would be easy to do with a stamp using a combination of exportedString and runCommand – use exportedString to get the HTML, and runCommand to pipe it through an HTML-to-markdown converter.

I like the idea @pat. Maybe we’ll see some highly appreciated code of yours to be used as a stamp some day?

Cheers

It may be easy enough to export to Markdown via HTML Export.

For example, you’d set $HTMLExportBoldStart to *, and $HTMLItalicStart to _. Other elements might be trickier; much depends on your precise needs, and sometimes a post-processor like HTML to Markdown could be handy

Thank you Mark @eastgate. I’ll think about it.

runCommand("/usr/local/bin/pandoc -f html -t markdown | pbcopy", exportedString(this, $HTMLExportTemplate));

This assumes your pandoc installation lives at /usr/local/bin/pandoc.

The action code copies the markdown to your clipboard so you can paste it elsewhere.

great @pat. But where and how do I run this „code“. During Export?

I did this as a stamp for one-off purposes.

What can I say, @pat. It works great. Thank you very much.

1 Like