Skip to main content

wrapper for python markdown but having a full HTML for the output (and nice things)

Project description

pymd

Description

pymd is a command line wrapper for Python Markdown library but having a full HTML file instead of only what it’s originally parsed.

pymd can parse a file, a folder or a list of files (in a .list) in their folder or to a specific one using -o. If the folder doesn’t exist, it will be created.

It includes all the extensions (extra (abbreviations, attributes lists, definition lists, fenced code blocks, footnotes, tables, smart strong), admonition, codehilite, headerid, meta, nl2br, sane_lists, toc, wikilinks) and you can add your own with --extension.

You can merge the files with the --merge or merge flag. This is where the .list is useful because it parses the files in order. If you merge the files but don’t specify an -o, the script will take the header parent folder as the filename or where the script runs.

By default, the script embeds the css file in each document, but by using the --css, the documents will link to the specified css. You can switch between sans (default) or serif fonts with the --serif command

The header file is just a normal (markdown) file that is shared among the “project” or is the header/title of the merged file. Thus it can have, for example, metadata (title, author, date…), the TOC of the merged files (using [TOC_HERE] placeholder), etc. The TOC’s depth can be modified using --toc (by default it shows all the headings).

The header can be specified with the --header or using a file named _header in the folder or .list.

You can create a “book” using --book or book; it just add navigational links in the documents and creates an index files which links to them. There two “styles” of navigation links: “prev & next” (default) and using the titles of the files with --nav. You can also create a custom index file and name it _index in the folder or .list, or specify one with --index

Usage examples

In same folder:

pymd.py nicefile.md

Process files in folder and create a book with serif font:

pymd.py /myfolder book -o /output --serif

Process files in .list, merge them:

pymd.py nice.list merge -o /output --header im_a_header.md

More examples and explanation (with images, yay!) in this blog post

Features

  • Batch process files (in folder or in a .list) with .md, .txt or .markdown extensions

  • Specify an output folder (with automatic creation)

  • Includes all the extensions installed by Python Markdown and you can even specify your own!

  • Merge files into one big HTML or create a little book with navigation links (NEW! create your own index file)

  • CSSed: leave the no-so-ugly embeded CSS (you can even switch between sans and serif fonts) or link to one of your own if you prefer.

  • Headers for files! So you can share the same metadata (like your beautiful name and the creative title of your work) in all the files or when you merge the files and forgot to include the main title of your project.

  • Wiki links: [](path) -> [title linked file](file|output_path)

  • Made with love <3

Changelog

0.5.5

  • Modified configuration: now global

  • fix relatives paths (book)

  • Wiki links to local files must use [](file|nice_file.md) syntax

0.5.4

  • code refactoring: to classes, def changes, vars…

  • fix bug when using a .list & output folder (not having name)

  • python 3.3 compatibility

0.5.3

  • check book pages for navigation (if only one file, disallow)

  • fix book navigation bug (having 2 files, and linking next with the 2nd, when shouldn’t)

  • fix: output path with one file

  • fix: finding <h1>

  • files are saved according to source dir tree

  • option to save files in one depth dir

  • relative links for book

  • wiki links parsing ( [](path) -> [title linked file](output_path) )

  • custom index for book

  • minor python 3 compatibility

  • toc depth filtering

  • navbar: change css, style links, titles for navbar (option)

  • better handling for merge/book options

  • fix: command line options

0.5

  • fix bug in output folder (merged files)

  • book support (resulting html files will have navigational links)

  • User can specify installed extensions

  • output folder support, with folder creation

  • fixed bugs

  • html5fying

0.3

  • .list support (convert & merge files according order)

  • filter files to parse by extensions

0.2

  • add merge option

  • add embeded CSS

0.1

  • Created

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pymd-0.5.5.zip (22.8 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page