Skip to main content

python scripts and panflute filters for producing technical documents from markdown

Project description

Markdown Manuscript Filters

A set of python utilities for converting documents from markdown to pdf, especially with the aim of producing technical / research manuscripts.

Workflow

The intended workflow is to write your manuscript in markdown, either from scratch or using markdown-manuscript-template. For live editing, use an editor (like Atom / VSCode) with a markdown preview plugin (I use markdown-preview-enhanced) ... .. but to use pandoc to produce a final document.

↪"why is this a good idea?"

... however, I've found myself wanting to customize more of the final result, and automate several cleanup steps along the way. Built on top of pandoc and panflute, this repo adds several useful python functions which can do things like:

  • compile markdown files containing @import statements into a single document
  • remove to-do items and comments for a cleaner pdf output
  • convert several alternate LaTeX equation delimeters to a standard pandoc-friendly format
  • chain these steps together to produce a single command to build your output files
  • and even produce an audio transcript of your manuscript 🤯

Installation

  • option 1: from PyPi - pypi page pip install markdown-manuscript-filters

  • option 2: locally, in edittable form from git repo:

    git clone https://github.com/awillats/markdown-manuscript-filters
    cd markdown-manuscript-filters
    pip install --editable .
    

Usage

sage: compile_markdown.py [-h] [--dir DIR] [--aux AUX] [--out OUT] [-p] [-v] [-e] [-w] src_file

Converts markdown with @import statements to all-in-one markdown file
- then filters out common annotation
- then converts to pdf with pandoc


positional arguments:
  src_file    source markdown file (with @imports)

optional arguments:
  -h, --help  show this help message and exit
  --dir DIR   starting directory
  --aux AUX   directory for auxiliary files
  --out OUT   directory for outputs (i.e. pdf)
  -p          open (p)df after successful compile
  -v          (v)erbose
  -e          halt execution if a step (e)rrors
  -w          halt execution if any (w)arnings -- implies -e

for example:

python -m compile_markdown -pve manuscript_v1  --aux publish/aux/ --out publish/output
↪example terminal output
.. compiling @imports ..
importing: 1_introduction.md
importing: 2_methods.md
importing: 3_results.md
writing compiled file to : tests/publish/aux/mv1_out.md
.. re-adding yaml ..
.. re-adding yaml, again ..
.. undoing line wrap ..
☼☼ PDF export complete ☼☼
☼☼ available at tests/publish/output/manuscript_v1.pdf ☼☼

OR, from inside a python script:

import markdown_manuscript_filters as mmf 
mmf.unicode_to_latex_file('tests/simple_file.md','tests/simple_file_out.md',is_verbose=True)

OR

python -c "import markdown_manuscript_filters as mmf ; mmf.unicode_to_latex_file('tests/simple_file.md','tests/simple_file_out.md',is_verbose=True)"

Image Attribution:

By johnny_automatic - Open Clip Art Library image's page, CC0, https://commons.wikimedia.org/w/index.php?curid=11066062

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

markdown-manuscript-filters-0.1.7.tar.gz (25.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

markdown_manuscript_filters-0.1.7-py3-none-any.whl (26.2 kB view details)

Uploaded Python 3

File details

Details for the file markdown-manuscript-filters-0.1.7.tar.gz.

File metadata

File hashes

Hashes for markdown-manuscript-filters-0.1.7.tar.gz
Algorithm Hash digest
SHA256 229c6289094f8387da44b1562578541c42d7b0c73ce02a5a939fc62081573006
MD5 da2daff965d27fcd83994dcefd172841
BLAKE2b-256 5fee12886e7b31c17b6227fe5b9ddd635bc2f844ba9944d22f7b2e0ac7b171cf

See more details on using hashes here.

File details

Details for the file markdown_manuscript_filters-0.1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for markdown_manuscript_filters-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 6a1dc3b107f42eadab85ce5da71ba1e0dcd422fb4e6fd2ee2456f6be711b48c1
MD5 1ccc9b39072603604a87badcac71b43e
BLAKE2b-256 415d515fc2677e5c465126f56535a55aec035b4d6c66c85a963fa54dceb16e8d

See more details on using hashes here.

Supported by

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