Skip to main content

Using Pandoc with Static Site Generators

Project description

Using Pandoc with Static Site Generators

This library aims to make it easy to write posts in Pandoc's Markdown and build them to static sites with ANY Static Site Generators (SSG) you want. After specifying the directory structure (pandoc4ssg.DirStruct) of your static site (depends on the SSG you used) and options for compiling posts (pandoc4ssg.PostHandler), pandoc4ssg builds the site for you.

Hugo

Below is an example that builds markdown files located in pandoc_posts/ into a Hugo site. See pandoc4ssg-example for details.

import pandoc4ssg

dir_struct = pandoc4ssg.DirStruct(
    tgt_dir_html="content/post",
    tgt_dir_tex="public/tex",
    pandoc_post_dir="pandoc_posts",
    static_tgt=None,
    public="public"
)

post_handler = pandoc4ssg.PostHandler(
    meta_keep = ["title", "subtitle", "author", "date", "categories", "tags"],
    meta_new=[("new_field", True)],
    use_toml=False,
    output_exts=".html",
    output_dir=True,
    pandoc_html_extra_args=['--citeproc'],
    dir_struct=dir_struct
)

pandoc4ssg.build(ssg_cmd="hugo -D", post_handler=post_handler)

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

pandoc4ssg-0.0.1.tar.gz (3.7 kB view hashes)

Uploaded Source

Built Distribution

pandoc4ssg-0.0.1-py3-none-any.whl (4.5 kB view hashes)

Uploaded Python 3

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