Skip to main content

MkDocs Backend for Foliant

MkDocs site built with Foliant

MkDocs backend lets you build websites from Foliant projects using MkDocs static site generator.

The backend adds three targets: mkdocs, site, and ghp. The first one converts a Foliant project into a MkDocs project without building any html files. The second one builds a standalone website. The last one deploys the website to GitHub Pages.

Installation

$ pip install foliantcontrib.mkdocs

Usage

Convert Foliant project to MkDocs:

$ foliant make mkdocs -p my-project
✔ Parsing config
✔ Applying preprocessor mkdocs
✔ Making mkdocs with MkDocs
─────────────────────
Result: My_Project-2017-12-04.mkdocs.src

Build a standalone website:

$ foliant make site -p my-project
✔ Parsing config
✔ Applying preprocessor mkdocs
✔ Making site with MkDocs
─────────────────────
Result: My_Project-2017-12-04.mkdocs

Deploy to GitHub Pages:

$ foliant make ghp -p my-project
✔ Parsing config
✔ Applying preprocessor mkdocs
✔ Making ghp with MkDocs
─────────────────────
Result: https://account-name.github.io/my-project/

Config

You don't have to put anything in the config to use MkDocs backend. If it's installed, Foliant detects it.

To customize the output, use options in backend_config.mkdocs section:

backend_config:
  mkdocs:
    mkdocs_path: mkdocs
    slug: my_awesome_project
    use_title: true
    use_chapters: true
    use_headings: true
    default_subsection_title: Expand
    mkdocs.yml:
      site_name: Custom Title
      site_url: http://example.com
      site_author: John Smith

mkdocs_path : Path to the MkDocs executable. By default, mkdocs command is run, which implies it's somewhere in your PATH.

slug : Result directory name without suffix (e.g. .mkdocs). Overrides top-level config option slug.

use_title : If true, use title value from foliant.yml as site_name in mkdocs.yml. It this case, you don't have to specify site_name in mkdocs.yml section. If you do, the value from mkdocs.yml section has higher priority.

If `false`, you *must* specify `site_name` manually, otherwise MkDocs will not be able to build the site.

Default is `true`.

use_chapters : Similar to use_title, but for pages. If true, chapters value from foliant.yml is used as pages in mkdocs.yml.

use_headings : If true, the resulting data of pages section in mkdocs.yml will be updated with the content of top-level headings of source Markdown files.

default_subsection_title : Default title of a subsection, i.e. a group of nested chapters, in case the title is specified as an empty string. If default_subsection_title is not set in the config, will be used.

mkdocs.yml : Params to be copied into mkdocs.yml file. The params are passed “as is,” so you should consult with the MkDocs configuration docs.

Preprocessor

MkDocs backend ships with a preprocessor that transforms a Foliant project into a MkDocs one. Basically, foliant make mkdocs just applies the preprocessor.

The preprocessor is invoked automatically when you run MkDocs backend, so you don't have to add it in preprocessors section manually.

However, it's just a regular preprocessor like any other, so you can call it manually if necessary:

preprocessors:
  - mkdocs:
      mkdocs_project_dir_name: mkdocs

mkdocs_project_dir_name : Name of the directory for the generated MkDocs project within the tmp directory.

Troubleshooting

Fenced Code Is Not Rendered in List Items or Blockquotes

MkDocs can't handle fenced code blocks in blockquotes or list items due to an issue in Python Markdown.

Unfortunately, nothing can be done about it, either on MkDocs's or Foliant's part. As a workaround, use indented code blocks.

Paragraphs Inside List Items Are Rendered on the Root Level

Check if you use four-space indentation. Python Markdown is stern about this point.

Release files for foliantcontrib.mkdocs 1.0.15

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for foliantcontrib.mkdocs 1.0.15
File Size Uploaded
foliantcontrib.mkdocs-1.0.15.tar.gz 7.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for foliantcontrib.mkdocs 1.0.15
File Interpreter ABI Platform
foliantcontrib.mkdocs-1.0.15-py3-none-any.whl Python 3 none any Details

Total release size: 15.3 kB

Release files / foliantcontrib.mkdocs-1.0.15.tar.gz

Download URL foliantcontrib.mkdocs-1.0.15.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
89c7d7916b0796c6e4f8216092b6f3bd75251b91800490f4d55716d30eb3cde1
BLAKE2b-256 checksum
How to use checksums
695be9341495ed491ee7bd5ade3732542fa2c749773de404a5a2cabcf1987c78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release files / foliantcontrib.mkdocs-1.0.15-py3-none-any.whl

Download URL foliantcontrib.mkdocs-1.0.15-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c1a05888688ff5b07aa54de6fd4edfd91f85386d894c65413af4e02565724522
BLAKE2b-256 checksum
How to use checksums
cc7708842a3d54bd6d6f995429def0edcdd15a6eca3d63feebac6a56f964b533
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release history Release notifications | RSS feed

This release

1.0.15 This release

2 release files

1.0.14

2 release files

1.0.12

2 release files

1.0.10

2 release files

1.0.9

2 release files

1.0.8

1 release file

1.0.7

1 release file

1.0.6

1 release file

1.0.5

1 release file

1.0.4

1 release file

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page