|
| 1 | +**This plugin is under development and the first version has not yet been released** |
| 2 | + |
| 3 | +# mkdocs-print-site-plugin |
| 4 | + |
| 5 | +[MkDocs](https://www.mkdocs.org/) plugin that adds a page to your site combining all pages, allowing your site visitors to *File > Print > Save as PDF* the entire site. |
| 6 | + |
| 7 | +## Features :star2: |
| 8 | + |
| 9 | +- Allow visitors to create PDFs from MkDocs sites themselves |
| 10 | +- Support for pagination |
| 11 | +- Support for generic and [mkdocs-material](https://github.com/squidfunk/mkdocs-material) themes, but works on all themes |
| 12 | +- Lightweight, no dependencies |
| 13 | + |
| 14 | +Currently, there is no support for PDF bookmarks. Have a look at alternatives like [mkdocs-pdf-export-plugin]() and [mkdocs-pdf-with-js-plugin](https://github.com/smaxtec/mkdocs-pdf-with-js-plugin). |
| 15 | + |
| 16 | +## Setup |
| 17 | + |
| 18 | +Install the plugin using `pip3`: |
| 19 | + |
| 20 | +```bash |
| 21 | +pip3 install mkdocs-print-site-plugin |
| 22 | +``` |
| 23 | + |
| 24 | +Next, add the following lines to your `mkdocs.yml`: |
| 25 | + |
| 26 | +```yml |
| 27 | +plugins: |
| 28 | + - search |
| 29 | + - print-site |
| 30 | +``` |
| 31 | +
|
| 32 | +> If you have no `plugins` entry in your config file yet, you'll likely also want to add the `search` plugin. MkDocs enables it by default if there is no `plugins` entry set. |
| 33 | + |
| 34 | + |
| 35 | +## TODO |
| 36 | + |
| 37 | +- Perhaps prevent the write file, by having the .md file be part of the package? Or put it in a tmp folder? See # https://github.com/greenape/mknotebooks/blob/master/mknotebooks/plugin.py#L126 |
| 38 | +- Add a demo website |
| 39 | +- Try to get PDF bookmarks working. Standards: https://www.w3.org/TR/2014/WD-css-gcpm-3-20140513/#bookmarks , lessons https://print-css.rocks/lessons |
| 40 | +- Add print button to every page? See approach described at https://github.com/danielfrg/mkdocs-jupyter |
| 41 | +- Ensure order of pages is consistent with navigation order, by making sure the plugin has been added last in the list. |
| 42 | +- ensure this plugin is defined last (to allow other plugins to make any modifications first). Return a warning if this is not the case. |
| 43 | +- Add option to change the print page title. |
| 44 | +- Add option to insert a Table of contents page. Here is how to create the leader dots and page numbers using CSS https://www.smashingmagazine.com/2015/01/designing-for-print-with-css/ |
| 45 | +- Add option to insert a frontcover page http://blog.michaelperrin.fr/2019/11/04/printing-the-web-part-2-html-and-css-for-printing-books/ |
| 46 | +- Display current chapter title in the footer http://blog.michaelperrin.fr/2019/11/04/printing-the-web-part-2-html-and-css-for-printing-books/ |
| 47 | +- check if appending print page does not break nested navigations (perhaps unit test?) |
| 48 | +- check tables with lots of columns, deal with overflow |
| 49 | +- Option to add print url after links? https://css-tricks.com/snippets/css/print-url-after-links/ |
| 50 | +- support different anchor links, or at least throw warning if different than # |
| 51 | + https://www.mkdocs.org/user-guide/writing-your-docs/ |
| 52 | + ```yml |
| 53 | + markdown_extensions: |
| 54 | + - toc: |
| 55 | + permalink: "#" |
| 56 | + ``` |
| 57 | +- ensure support of 'use_directory_urls' settings https://www.mkdocs.org/user-guide/configuration/#use_directory_urls |
| 58 | + |
| 59 | +```python |
| 60 | +[p.url for p in self.pages] |
| 61 | +['index.html', 'z.html', 'a.html'] |
| 62 | +``` |
| 63 | + |
| 64 | +## Contributing |
| 65 | + |
| 66 | +Contributions are very welcome! Start by reading the [contribution guidelines](https://timvink.github.io/mkdocs-print-site-plugin/contributing.html). |
0 commit comments