Markdown to Book (was: [TxMt] TextMate Manual)

Allan Odgaard throw-away-1 at macromates.com
Mon Dec 26 12:30:31 UTC 2005


On 23/12/2005, at 13:17, soryu2 at gmail.com wrote:

> As I am writing some documentation in markdown myself at the moment  
> it would be a great help if you could share those scripts (along  
> with your modified markdown bundle maybe).

I've attached an archived version of my `manual` folder, which is  
self-contained. My Markdown bundle modifications are limited to the  
completion command mentioned (for references) and a custom drag  
command for images to work with my path setup.

The archive contains:

    pages/*.markdown     -- the actual manual (written in markdown.)
    images/*.png         -- the images (although I removed these from  
the archive.)
    templates/*.rhtml    -- three templates for how the Markdown  
should look as HTML.
    markdown.references  -- my reference list used by the pages.

    update_references.sh -- grep through `pages/*.markdown` for  
references not in the list (and add these with a stub) plus tell if  
there are unused references.

    add_image_size.rb    -- add width/height arguments to image tags  
which lack them (read from stdin, write to stdout), also converts the  
src argument to an absolute (macromates.com) path. This is used by  
`generate.rb`.

    generate.rb          -- this generate HTML versions of the  
markdown pages, it writes these to `html`. The script goes through  
`pages/*.markdown` in alphabetital order and strips any numeric  
prefix in the HTML versions.

You can provide other templates or another output folder to the  
`generate.rb` script. E.g. to generate the online version of the  
documentation I call:

    ./generate.rb \
      -toc_template="../site/templates/sidebar.rhtml" \
      -chapter_template="../site/templates/doc_chapter.rhtml" \
      -all_template="../site/templates/doc_all.rhtml" \
      -output_dir="../site/html/textmate/manual"

In practice you should be able to just replace the contents of  
`pages` with your stuff, and run `./generate.rb` (with `manual` as  
cwd) -- though you'll have to modify the `add_image_size.rb` to not  
have it alter relative image paths (and/or edit `generate.rb` from  
where it's called, which btw also set `images` as cwd for this script).


-------------- next part --------------
A non-text attachment was scrubbed...
Name: manual.tbz
Type: application/octet-stream
Size: 51628 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20051226/a3a15250/attachment.tbz>
-------------- next part --------------




More information about the textmate mailing list