Skip navigation
Currently Being Moderated

[Ann] Markdown To InDesign with MarkdownID

Jun 4, 2012 3:43 PM

Tags: #javascript #indesign #import #plain_text #markdown

"Markdown" is the name of a versatile plain text formatting syntax, designed by John Gruber a surprising number of years ago (2004) and has steadily gained popularity ever since. You *might* not realize it, but you might be using it *already*! (And this is _exactly_ what Markdown text looks like!)

 

The original Markdown is a Perl script that converts plain text and its embedded codes into properly formatted HTML; nowadays, lots of on-line editors support it through Python and even Javascript, so you can enter and edit formatted text with ease, even when using an extremely basic text editor.

 

There are no import filters for InDesign to convert MD straight into InDesign formatted text; there is a workaround, using its native to-HTML capabilities followed by Rorohiko's HTML-to-InDesign, but that's what it is: a workaround.

 

I wrote a script that imports and translates MD formatted text straight into InDesign. It has a couple of limitations, due to the different Document Models of HTML and InDesign. In HTML, for example, you can nest 'paragraph' and 'character' objects at will; for example, a header inside a blockquote, or code inside italic text. For InDesign that's not as easy without resorting to lots of 'local' overrides, which I personally abhor. (And so should _you_ -- if you just change the style of your text, all overrides could be gone!) So I opted for an easier way: one-level paragraph and one-level character styles only. Still, that's enough to nicely format most of the blog posts and online documentation I experimented with!

... I even found some time to add two nice additions: tables and easy-accented characters.

 

Read all about my version at my own web site: http://www.jongware.com/markdownid.html, and don't forget to check out the Daring Fireball In Person's original web site on same (http://daringfireball.net/projects/markdown/) and the original version of my web page in Markdown format.

 


Markdown bears the following copyright statement:

Copyright © 2004, John Gruber

http://daringfireball.net/

All rights reserved.

 
Replies
  • Currently Being Moderated
    Jul 2, 2012 4:14 PM   in reply to [Jongware]

    What's the minimum version of indesign for this script? I get an error, using CS1 on the Mac,

     

    Error Number: 3

    Error String: "Cannot assign Value"

    Line: 701

    Source "     match = In.match(/^ {0,3}\[([^\]]+)\]:/s+(\S+)\s*(".+?\s*$/)||"

    Offending Text "="

     

    Thanks,

      Ian

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)