Tuesday 26 September 2017

How to Automatically Convert Markdown to HTML

Formatting text should be easy. Often, however, it's not. If you've ever opened a Word document in an earlier version of Word or in a different word processor app and then spent half an hour getting your formatting looking perfect again, you know how annoying rich text can be. Even websites aren't perfect—open the same site side-by-side in Internet Explorer and Google Chrome, and you could easily make a Spot the Differences game.

Markdown formatting avoids that by using just plain text. Instead of clicking B in a toolbar to add bold text, you add two asterisks around text like **this**. Add links with [brackets for the link title](and parentheses for the URL), blockquotes with > greater than symbol, bullet point lists with - dashes, and with that and a few more options you can format text almost any way you want right from your keyboard. It's similar to the basic formatting one would add with a typewriter a few decades ago.

But you can't exactly send management a page covered with asterisks and brackets the next time they ask for a status report. You need to turn that Markdown into formatted text. Here's how.

How to Export Markdown Text Online

Export Markdown to the format you want with Dillinger
Dillinger is a quick way to turn Markdown text into standard formatting

All you need to write Markdown is a plain text editor. Notepad or TextEdit would do. Heck, you could type out Markdown text in an email or a chat app. As long as you can type text and symbols, you're good.

Turning that text into a formatted document is another story. Windows and macOS don't come with built-in Markdown tools—not yet, anyhow—so you'll need something extra.

The easiest option is a quick web app, and there are a number of great choices:

  • Dillinger (pictured above) is one of the best because it's a full-featured online writing app that also makes it easy to export Markdown. You can write Markdown online in its editor or just paste in your completed text, then preview the formatted version on the right. Copy the formatted text for a quick export—or click the Export as menu to save your document in HTML, PDF, or plain text formats.
  • Markdown Web Dingus is the original online Markdown exporter from Markdown's creator, John Gruber. Paste your Markdown in the main text box and click Convert to get a rich text and HTML version. There's a Markdown reference guide on the right for a quick refresher, too.
  • Try pandoc! is the most full-featured converter—and it works with more than Markdown. Paste your Markdown, HTML, LaTeX, or other formatted text on the left, then convert it to the format you want on the right. That way, you could turn your finished HTML back into Markdown if you want.
Google Docs Markdown

Or, if you use Google Docs, you could just install an add-on to export Markdown text right from your word processor. Google Docs doesn't natively support Markdown—you can write in it, adding symbols yourself, but it doesn't preview the formatting by default.

For that, add the free Preview Markdown add-on. Open its sidebar, and you'll see a live rich text preview of your formatted text. You can then copy that rich text into a new document for a quick way to format text. Or, install the gd2md-html add-on to download an HTML copy of your Markdown writing.

How to Export Markdown Text on Your Computer

Export Markdown in iA Writer
Markdown writing apps like iA Writer include tools to export your text, too

Web apps are handy for one-off conversions. If you're writing in Markdown every day, you'll want a tool built just for Markdown. Many of the best plain text writing apps are designed just for that. They let you write in plain text with Markdown formatting, typically showing the formatting along with the Markdown characters as you type. Then, you can preview the finished text, copy it as rich text, or save the whole document in the format you want.

The best option is with a writing app. There are more than we could possibly list, but some of our favorites include iA Writer and Byword for Mac, and Caret or MarkdownPad for Windows. Or, for longform writing, apps like Ulysses and Scrivener are great both for organizing your thoughts and for exporting Markdown in the format you want.

Want to just export Markdown to the format you want? There are two great options for just that, too, without a writing app. Marked is the best for Macs since it makes exporting text so simple, with beautiful templates and options to save your documents in PDF, Word, HTML, or other formats. Or, for more powerful converting tools, you can install Pandoc on your Windows, Mac, or Linux computer to convert Markdown text into the format you want from Terminal.

Automatically Convert Markdown to HTML and PDF with Zapier

Convert Markdown to HTML with Zapier Formatter

What if you want to write in Markdown all the time, perhaps from apps that don't support Markdown natively, and you don't want to have to manually export your text every time? App automation tool Zapier is just what you need. Zapier can watch your favorite app—Evernote, Salesforce, or even your email app—for new Markdown text, and then put it to work for you.

Here's how:

  • Log into Zapier or create a free account.
  • Click the "Make a Zap" button to set up a Zap.
  • Connect the app that has your text to Zapier, then add a Formatter Text action to your workflow.
  • Select Convert Markdown to HTML from the Transform menu.
  • Click the + icon beside the Input field and select your Markdown text from the trigger app that you want Zapier to convert.

Now that you've got your text formatted in HTML, you can use it any way you want. Add it to WordPress and publish your thoughts as a blog post. Save it to a Dropbox text file, and sync it to your website for a simple flat-file site. Copy it to Gmail and send a formatted email powered by Markdown.

Zapier Google Print to save as PDF
Want a formatted copy of your Markdown text? Just 'print' it to Google Drive for a PDF copy.

Need a formatted PDF document from your Markdown-formatted text instead? Just add a Google Cloud Print action to your Zap. Google Cloud Print is designed to let you print documents from anywhere, turning any printer into an online smart printer. That'd work if you want to actually print out a copy of your document. But it also can save a copy of your text to Google Drive as a PDF or Google Docs file—which is a handy way to put your Markdown text to work.

Just add Google Cloud Print to Zapier with your Google account, then add the formatted HTML text from the Formatter step to the Content field. Select Save to Google Drive from the Which Printer menu, then turn on your Zap, and whenever you add new Markdown text to your trigger app, Zapier will format it and save it as a PDF to your Google Drive.

Publishing online or making a finished document, Markdown and Zapier are good for both.

Here's a pre-made Zap to help you do just that:


Markdown formatting is easy to write, but you still can't submit your next quarterly report or university essay in pure Markdown. You don't have to. Whether you're writing in a Markdown app designed for exporting or use a Zapier workflow to automatically turn your Markdown text into a finished blog post or document, you can write the way you want and still get your text in the format people expect.


Do More With Zapier Formatter

Want to automate more of your work with text? Check out the other tutorials in this series for more ways to use Formatter—along with handy tips for other apps you might already be using:



source https://zapier.com/blog/markdown-html-export/

No comments:

Post a Comment