MkDocs backend for Foliant documentation generator.
Project description
# MkDocs Backend for Foliant
MkDocs backend lets you build websites from Foliant projects using [MkDocs](https://mkdocs.org) static site generator.
The backend adds two targets: `mkdocs` and `site`. The first one converts a Foliant project into a MkDocs project without building any html files. The second one builds a standalone website.
## Installation
```shell
$ pip install foliantcontrib.mkdocs
```
## Usage
Convert Foliant project to MkDocs:
```shell
$ 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:
```shell
$ foliant make site -p my-project
✔ Parsing config
✔ Applying preprocessor mkdocs
✔ Making site with MkDocs
─────────────────────
Result: My_Project-2017-12-04.mkdocs
```
## 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:
```yaml
backend_config:
mkdocs:
binary_path: mkdocs
use_title: true
use_chapters: true
mkdocs.yml:
site_name: Custom Title
site_url: http://example.com
site_author: John Smith
```
`binary_path`
: Path to the MkDocs executable. By default, `mkdocs` command is run, which implies it's somewhere in your `PATH`.
`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`.
`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](http://www.mkdocs.org/user-guide/configuration/).
## 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:
```yaml
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](https://github.com/Python-Markdown/markdown/issues/53).
Unfortunately, nothing can be done about it, either on MkDocs's or Foliant's part. As a workaround, use [indented code blocks](https://daringfireball.net/projects/markdown/syntax#precode).
### Paragraphs Inside List Items Are Rendered on the Root Level
Check if you use **four-space indentation**. [Python Markdown is stern about this point](https://pythonhosted.org/Markdown/index.html#differences).
MkDocs backend lets you build websites from Foliant projects using [MkDocs](https://mkdocs.org) static site generator.
The backend adds two targets: `mkdocs` and `site`. The first one converts a Foliant project into a MkDocs project without building any html files. The second one builds a standalone website.
## Installation
```shell
$ pip install foliantcontrib.mkdocs
```
## Usage
Convert Foliant project to MkDocs:
```shell
$ 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:
```shell
$ foliant make site -p my-project
✔ Parsing config
✔ Applying preprocessor mkdocs
✔ Making site with MkDocs
─────────────────────
Result: My_Project-2017-12-04.mkdocs
```
## 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:
```yaml
backend_config:
mkdocs:
binary_path: mkdocs
use_title: true
use_chapters: true
mkdocs.yml:
site_name: Custom Title
site_url: http://example.com
site_author: John Smith
```
`binary_path`
: Path to the MkDocs executable. By default, `mkdocs` command is run, which implies it's somewhere in your `PATH`.
`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`.
`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](http://www.mkdocs.org/user-guide/configuration/).
## 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:
```yaml
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](https://github.com/Python-Markdown/markdown/issues/53).
Unfortunately, nothing can be done about it, either on MkDocs's or Foliant's part. As a workaround, use [indented code blocks](https://daringfireball.net/projects/markdown/syntax#precode).
### Paragraphs Inside List Items Are Rendered on the Root Level
Check if you use **four-space indentation**. [Python Markdown is stern about this point](https://pythonhosted.org/Markdown/index.html#differences).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for foliantcontrib.mkdocs-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | cbddaa351a714d42d3479f254f88a7dd49a4f7b2abe9cebc50b4e28759c85bc2 |
|
MD5 | 604db09d4aaf6a3c65ff64b1a8011fcc |
|
BLAKE2b-256 | d9f555d74e89215f0a0a06cc23568a6d626800194561f00e6dc0bd5490467e83 |
Close
Hashes for foliantcontrib.mkdocs-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b3635a3531decdb5ae229534cb06f6df7f70f4ca2f17b8764d2772f836f4b93f |
|
MD5 | d7d10f65bde07314d0855724e427cefe |
|
BLAKE2b-256 | a3ff7390d34857ca05c28ad5f7f8bbb90abd80a2d5a1535defcaf201396835bf |