Documentation mkdocs-print-site-plugin
Description | MkDocs Plugin allowing your site visitors to *File > Print > Save as PDF* the entire site. |
Author(s) | Tim Vink |
Repository | https://github.com/timvink/mkdocs-print-site-plugin |
Copyright | Copyright © 2024 Maintained by Tim Vink. |
Table of Contents
mkdocs-print-site-plugin↵
MkDocs plugin that adds a page to your site combining all pages, allowing your site visitors to File > Print > Save as PDF the entire site.
Installation↵
Install the plugin using pip3
:
pip3 install mkdocs-print-site-plugin
Next, add the following lines to your mkdocs.yml
:
plugins:
- search
- print-site
Make sure to put
print-site
to the bottom of the plugin list. This is because other plugins might alter your site (like the navigation), and you want these changes included in the print page.If you have no
plugins
entry in your config file yet, you'll likely also want to add thesearch
plugin. MkDocs enables it by default if there is noplugins
entry set.
Usage↵
- Navigate to
/print_page/
orprint_page.html
- Export to standalone HTML (see export to HTML)
- Export to PDF using your browser using File > Print > Save as PDF (see export to PDF)
Options↵
You can customize mkdocs-print-site-plugin
in your mkdocs.yml
with the following settings:
plugins:
- print-site:
add_to_navigation: false
print_page_title: 'Print Site'
add_print_site_banner: false
# Table of contents
add_table_of_contents: true
toc_title: 'Table of Contents'
toc_depth: 6
# Content-related
add_full_urls: false
enumerate_headings: true
enumerate_figures: true
add_cover_page: true
cover_page_template: ""
path_to_pdf: ""
include_css: true
enabled: true
exclude:
add_to_navigation
- Default is
false
. Adds a link 'Print Site' to your site navigation. You can also set tofalse
and explicitly include the link in your navigation (/print_page
or/print_page.html
). print_page_title
- Default is
'Print Site'
. Whenadd_to_navigation
is set totrue
this setting controls the name of the print page in the navigation of the site. This setting is ignored whenadd_to_navigation
is set tofalse
. add_table_of_contents
- Default is
true
. Adds a table of contents section at the beginning of the print page (in print version, the HTML version has a different sidebar ToC). toc_title
- Default is
'Table of Contents'
. Whenadd_table_of_contents
is set totrue
this setting controls the name of the table of contents of the print version of the print page. This setting is ignored whenadd_table_of_contents
is set tofalse
. toc_depth
- Default is
3
. Whenadd_table_of_contents
is set totrue
this setting controls the depth of the table of contents in the print version of the print page. This setting is ignored whenadd_table_of_contents
is set tofalse
. add_full_urls
-
Default is
false
. When printing a page, you cannot see the target of a link. This option adds the target url in parenthesis behind a link.For example "google.com" will be replaced by "google.com (https://www.google.com)"
enumerate_headings
-
Default
true
. This will add numbering (enumeration) to all headings and sections, as well as the table of contents. Note this will only enumerate the print site page; if you want to enumerate the entire site, you can use mkdocs-enumerate-headings-plugin.Example "1.2 A chapter subsection".
enumerate_headings_depth
- Default
6
. Ifenumerate_headings
, the depth until which headings and sections are enumerated. enumerate_figures
- Default
true
. This will add numbering to all figure captions (for example "Figure 1:"). Works especially well with mkdocs-img2fig-plugin. add_cover_page
- Default
false
. When enabled, a cover page is added to the print page, displaying thesite_title
and other information from themkdocs.yml
file. See also Customizing the cover page cover_page_template
- Default
""
. The path to a custom cover page template to use. See Customizing the Cover Page for more info. add_print_site_banner
- Default
false
. When enabled, a banner is added to the top of the HTML print page, explaining to users the current page contains all site pages. See Customizing the print site banner for more info. print_site_banner_template
- Default
""
. The path to a custom print site banner template to use. See Customizing the print site banner for more info. path_to_pdf
- Default is empty. Option to make it easier to add a link to the PDF version of the site on each page. See Adding a PDF button for more info.
include_css
- Default is
true
. When disabled the print-site stylesheets are not included. This makes it easy to overwrite the CSS with your own stylesheets, using the extra_css option in yourmkdocs.yml
file. enabled
-
Default is
true
. Enables you to deactivate this plugin. A possible use case is local development where you might want faster build times. It's recommended to use this option with an environment variable together with a default fallback (introduced inmkdocs
v1.2.1, see docs). Example:# mkdocs.yml plugins: - print-site: enabled: !ENV [ENABLED_PRINT_SITE, True]
Which enables you do disable the plugin locally using:
export ENABLED_PRINT_SITE=false mkdocs serve
exclude
- Default is empty. Allows to specify a list of page source paths that should not be included in the print page. See Do Not Print for more info.
How to guides ↵
Export to PDF↵
After enabling the print-site
plugin in your mkdocs.yml
, exporting to PDF is as simple as browsing to /print_page
or /print_page.html
(url depends on your mkdocs setting use_directory_urls
). From your browser you can use File > Print > Save as PDF.
If you want to automatically create PDFs of your mkdocs website, you can automate the process using a headless chrome plugin.
If you need more control over the PDF layout, I recommend the mkdocs-with-pdf plugin.
Avoid creating PDFs with Firefox
Firefox has some issues with print margins cutting of content, and anchors links not working properly. For more details see mkdocs-print-site-plugin#56
Automated export using nodejs and chrome↵
We can use nodejs together with the puppeteer headless chrome node.js package:
- Install nodejs
- Download puppeteer in the root of your project using the node package manager:
npm i --save puppeteer
- Save the script
export_to_pdf.js
(see below) in the root of your project - Start a webserver with your site (
mkdocs serve
) - In a separate terminal window, you can now run the PDF export with
url
(to your print page),pdfPath
(name of output file) andtitle
arguments:
node export_to_pdf.js http://localhost:8000/print_page.html out.pdf 'title'
export_to_pdf.js
// Credits for script: https://github.com/majkinetor/mm-docs-template/blob/master/source/pdf/print.js
// Requires: npm i --save puppeteer
const puppeteer = require('puppeteer');
var args = process.argv.slice(2);
var url = args[0];
var pdfPath = args[1];
var title = args[2];
console.log('Saving', url, 'to', pdfPath);
// date – formatted print date
// title – document title
// url – document location
// pageNumber – current page number
// totalPages – total pages in the document
headerHtml = `
<div style="font-size: 10px; padding-right: 1em; text-align: right; width: 100%;">
<span>${title}</span> <span class="pageNumber"></span> / <span class="totalPages"></span>
</div>`;
footerHtml = ` `;
(async() => {
const browser = await puppeteer.launch({
headless: true,
executablePath: process.env.CHROME_BIN || null,
args: ['--no-sandbox', '--headless', '--disable-gpu', '--disable-dev-shm-usage']
});
const page = await browser.newPage();
await page.goto(url, { waitUntil: 'networkidle2' });
await page.pdf({
path: pdfPath, // path to save pdf file
format: 'A4', // page format
displayHeaderFooter: true, // display header and footer (in this example, required!)
printBackground: true, // print background
landscape: false, // use horizontal page layout
headerTemplate: headerHtml, // indicate html template for header
footerTemplate: footerHtml,
scale: 1, //Scale amount must be between 0.1 and 2
margin: { // increase margins (in this example, required!)
top: 80,
bottom: 80,
left: 30,
right: 30
}
});
await browser.close();
})();
Export to HTML↵
After enabling the print-site
plugin in your mkdocs.yml
, you will have your entire site combined into a single page.
That allows you to create a standalone HTML page: a single self-contained file that has all images, styling and scripts embedded. This means you could send a site as an email attachment, a use case common within companies where deploying static sites might be more involved. This works because all the resources the page uses, such images, stylesheets (CSS) and interactive elements (javascript) are embedded into in a single HTML file using data URLs.
You can create a .html file export using your internet browser (f.e. save as > webpage, single page). You can also do this programmatically, for example using the htmlark python package:
pip install htmlark[http,parsers]
To create the export:
mkdocs build
cd site/
# when mkdocs.yml has use_directory_urls: true (the default)
htmlark print_page/index.html -o standalone.html
# when mkdocs.yml has use_directory_urls: false
htmlark print_page.html -o standalone.html
Adding a print button↵
You might want to customize your site to include a 'print' button on every page that will lead to the print page. See the example in the top right corner of this page 👆.
MkDocs supports theme extension, an easy way to override parts of a theme. That will allow you to add a button to the top of every page.
This plugin adds to the context a page.url_to_print_page
which contains the relative link from a page to the print page. You can use page.url_to_print_page
when customizing a theme:
Adding a print button to mkdocs-material theme↵
In the mkdocs-material theme you can create an override for main.html
(see customization).
Example:
theme:
name: material
custom_dir: docs/overrides
plugins:
- print-site
{% extends "base.html" %}
{% block content %}
{% if page.url_to_print_page %}
<a href="{{ page.url_to_print_page }}" title="Print Site" class="md-content__button md-icon">
{% include ".icons/material/printer.svg" %}
</a>
{% endif %}
{{ super() }}
{% endblock content %}
Adding a print button to mkdocs theme↵
You can also customize the base mkdocs theme, by overriding main.html
.
Example:
theme:
name: mkdocs
custom_dir: docs/overrides
plugins:
- print-site
{% extends "base.html" %}
{% block repo %}
{% if page.url_to_print_page %}
<li class="nav-item">
<a href="{{ page.url_to_print_page }}" title="Print Site" class="nav-link">
<i class="fa fa-print"></i> Print
</a>
</li>
{% endif %}
{{ super() }}
{% endblock repo %}
Adding a PDF button↵
Having users create a PDF of your website requires them to navigate to the print page and File > Print > Save as PDF (see export to PDF). You can make downloading a PDF version of your website even easier for your users by including a 'PDF' button on every page (like the one in the right corner of this page 👆).
MkDocs supports theme extension, an easy way to override parts of a theme. That will allow you to add a button to the top of every page.
This plugin adds to the context a page.url_to_print_page
which contains the relative link from a page to the print page. You can use page.url_to_print_page
when customizing a theme:
Info
While it might be easier for your users, using this option means you need to re-create the PDF everytime you make a change to your website.
If you use this option and you are using version control like git, you might want to also gitignore the PDF file.
Adding a PDF button to mkdocs-material theme↵
In the mkdocs-material theme you can create an override for main.html
(see customization).
Example:
theme:
name: material
custom_dir: docs/overrides
plugins:
- print-site:
path_to_pdf: "assets/the_name_of_your_file.pdf"
{% extends "base.html" %}
{% block content %}
{% if page.url_to_pdf %}
<a href="{{ page.url_to_pdf }}" title="Site PDF" class="md-content__button md-icon">
{% include ".icons/material/file-pdf-box.svg" %}
</a>
{% endif %}
{{ super() }}
{% endblock content %}
Adding a print button to mkdocs theme↵
You can also customize the base mkdocs theme, by overriding main.html
.
Example:
theme:
name: mkdocs
custom_dir: docs/overrides
plugins:
- print-site:
path_to_pdf: "assets/the_name_of_your_file.pdf"
{% extends "base.html" %}
{% block repo %}
{% if page.url_to_pdf %}
<li class="nav-item">
<a href="{{ page.url_to_pdf }}" title="Site PDF" class="nav-link">
<i class="fas fa-file-pdf"></i> PDF
</a>
</li>
{% endif %}
{{ super() }}
{% endblock repo %}
Customize the cover page↵
By default the add_cover_page
option is set to true
, which will add a cover page to the print page. You might want to customize it more to your liking.
You can do that by specifying the path to a custom cover page template in the mkdocs.yml
file. This file should be a standard jinja2 template where you can combine HTML and jinja2 variables. The information specified in mkdocs.yml
will already by available as jinja2 variables (see mkdocs project information).
Example:
plugins:
- print-site:
add_cover_page: true
cover_page_template: "docs/assets/templates/custom_cover_page.tpl"
{% if config.site_name %}
<h1>{{ config.site_name }}</h1>
{% endif %}
<h2>This is my custom print cover page</h2>
To get you started have a look at the default cover_page.tpl.
Adding images↵
When adding images to your custom cover page template, make sure to define the image source as the hosted image path. The url for the image stored in docs/assets/img/example.png
would be /assets/img/example.png
.
Example:
{% if config.site_name %}
<h1>{{ config.site_name }}</h1>
{% endif %}
<img src="/assets/img/example.png" />
For a full working example have a look at this custom cover page with an image.
Adding configurable content↵
You might want to add some content to your cover page that's not yet specified in your mkdocs.yml
file. Of course you could just hard-code it in your custom template file, but you could also make use of MkDocs's extra context feature, allowing you to use custom variables from your config file with {{ config.extra.<your variable> }}
.
Example:
plugins:
- print-site:
add_cover_page: true
cover_page_template: "docs/assets/templates/custom_cover_page.tpl"
extra:
abstract: This is a report about a topic
{% if config.site_name %}
<h1>{{ config.site_name }}</h1>
{% endif %}
<p>{{ config.extra.abstract }}</p>
Change the styling↵
You'll likely also want to change the styling of the cover page to your liking. You can add your own CSS file using the extra_css option from MkDocs. mkdocs-print-site-plugin
wraps the cover page in a <section id="print-site-cover-page">
. You should use this in your CSS to ensure not affecting other pages.
Example:
plugins:
- print-site:
add_cover_page: true
extra_css:
- docs/assets/css/my_cover_page.css
#print-site-cover-page h1 {
color: blue;
}
Customize the print site banner↵
When a user visits the print page, it might not be immediately obvious how to use it. You can set the add_print_site_banner
option to true
to add a banner to the top of the HTML print page that will be hidden when printing.
You might want to customize this banner, for example by translating it to your language. You can do that by specifying the path to a custom banner template in the mkdocs.yml
file. This file should be a standard jinja2 template where you can combine HTML and jinja2 variables. The information specified in mkdocs.yml
will already by available as jinja2 variables (see mkdocs project information).
Example:
plugins:
- print-site:
add_print_site_banner: true
print_site_banner_template: "docs/assets/templates/custom_banner.tpl"
<p>
<em>This box will disappear when printing</em>
<span style="float: right"><a href="https://timvink.github.io/mkdocs-print-site-plugin/">mkdocs-print-site-plugin</a></span>
</p>
<p>This page has combined all site pages into one. You can export to PDF using <b>File > Print > Save as PDF</b>.</p>
<p>See also [export to PDF](https://timvink.github.io/mkdocs-print-site-plugin/how-to/export-PDF.html) and [export to standalone HTML](https://timvink.github.io/mkdocs-print-site-plugin/how-to/export-HTML.html).</p>
As an example, have a look at the default print_site_banner.tpl.
Adding configurable content↵
You might want to add some content to your print banner that's not yet specified in your mkdocs.yml
file.
Of course you could just hard-code it in your custom template file, but you could also make use of MkDocs's extra context feature, allowing you to use custom variables from your config file with {{ config.extra.<your variable> }}
.
Example:
plugins:
- print-site:
add_print_site_banner: true
print_site_banner_template: "docs/assets/templates/custom_banner.tpl"
extra:
banner_message: "Save this page using File > Print > Save as PDF"
<p>
<em>This box will disappear when printing</em>
<span style="float: right"><a href="https://timvink.github.io/mkdocs-print-site-plugin/">mkdocs-print-site-plugin</a></span>
</p>
<p>{{ config.extra.banner_message }}</p>
Exclude content from print↵
You might want to exclude certain parts of you website from the print site page. This can be useful when you don't want to include certain page, large images, tables, certain admonitions or appendixes to your site exports.
Ignoring elements in a page↵
mkdocs-print-site-plugin
offers the CSS class .print-site-plugin-ignore
, that will ignore certain elements.
The Attribute Lists extension, which is part of the standard Markdown library, allows to add HTML attributes and CSS classes to Markdown elements, and needs to be enabled in your mkdocs.yml
.
To apply the .print-site-plugin-ignore
class to an element you can use {: .print-site-plugin-ignore }
on many different markdown elements, as explained in the attr_list docs. attr_list
does not support all markdown elements (see limitations), but remember Markdown is a subset of HTML and anything which cannot be expressed in Markdown can always be expressed with raw HTML directly.
Example:
plugins:
- print-site
markdown_extensions:
- attr_list
# Example page
This paragraph will not be part of the print site page.
{: .print-site-plugin-ignore }
![ignored image](some/path/image.png){: .print-site-plugin-ignore }
You can also use HTML to hide things from printing:
<span class="print-site-plugin-ignore">hello</span>
As another example, this paragraph will not be printed. Go have a look at the print site page and you'll find it missing.
Ignoring admonitions↵
Adding a class to admonitions is not supported by attr_list
. You can use the .print-site-plugin-ignore
class directly on admonitions however.
Example:
!!! info print-site-plugin-ignore
As an example, this admonition will not be printed. Go have a look at the [print site page](/print_page.html) and you'll find it missing.
Which renders as:
Info
As an example, this admonition will not be printed. Go have a look at the print site page and you'll find it missing.
Ignoring an entire page↵
In the plugin configuration in mkdocs.yml
you can specify a list of page source paths (one per line) that should not be included in the print page (excluded from processing by this plugin). This can be useful for example to exlude large appendixes that you only want to display on the web version. The source path of a page is relative to your docs/
folder. You can also use globs instead of full source paths. To exclude docs/subfolder/page.md
specify in your mkdocs.yml
a line under exclude
: with - subfolder/page.md
.
Example:
# mkdocs.yml
plugins:
- print-site:
exclude:
- index.md
- subfolder/page.md
- another_page.md
- folder/*
Ended: How to guides
Demo Content↵
This content is here to demonstrate what it looks like while printing.
Go ahead and visit the print page and check it out!
Links to other pages↵
mkdocs-print-site-plugin
will fix internal links when combining all the pages into one. Try navigating to other site pages using these internal links:
Links to other sections↵
When combining all pages into one, mkdocs-print-site-plugin
will also ensure anchor links keep working (also to anchor links on other pages). Try them out:
- Dummy section lower down this demo page
- The Manual Testing in the contributing guide
Charts↵
From the mkdocs-charts-plugin:
Magic links↵
Magic links and emails: turned to links as recognized
Output | Code |
---|---|
http://www.google.com | http://www.google.com |
johndoe@gmail.com | johndoe@gmail.com |
www.google.com | www.google.com |
Markdown extensions↵
MkDocs has support for many markdown extensions (see mkdocs-material reference). Below is a quick showcase so you can see how they print.
Phasellus posuere in sem ut cursus
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor massa, nec semper lorem quam in massa.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor massa, nec semper lorem quam in massa.
Note
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor massa, nec semper lorem quam in massa.
def bubble_sort(items):
for i in range(len(items)):
for j in range(len(items) - 1 - i):
if items[j] > items[j + 1]:
items[j], items[j + 1] = items[j + 1], items[j]
Nunc eu odio eleifend, blandit leo a, volutpat sapien. Phasellus posuere in sem ut cursus. Nullam sit amet tincidunt ipsum, sit amet elementum turpis. Etiam ipsum quam, mattis in purus vitae, lacinia fermentum enim.
Note
This is a collapsible block, that is collapsed by default.
import tensorflow as tf
1 2 3 4 5 |
|
def bubble_sort(items):
for i in range(len(items)):
for j in range(len(items) - 1 - i):
if items[j] > items[j + 1]:
items[j], items[j + 1] = items[j + 1], items[j]
The range()
function is used to generate a sequence of numbers.
Ctrl+Alt+Del
#include <stdio.h>
int main(void) {
printf("Hello world!\n");
return 0;
}
#include <iostream>
int main(void) {
std::cout << "Hello world!" << std::endl;
return 0;
}
Another tabbed content
- Sed sagittis eleifend rutrum
- Donec vitae suscipit est
- Nulla tempor lobortis orci
- Sed sagittis eleifend rutrum
- Donec vitae suscipit est
- Nulla tempor lobortis orci
Embedding content:
Example
Example:
* Sed sagittis eleifend rutrum
* Donec vitae suscipit est
* Nulla tempor lobortis orci
Result:
- Sed sagittis eleifend rutrum
- Donec vitae suscipit est
- Nulla tempor lobortis orci
Example:
1. Sed sagittis eleifend rutrum
2. Donec vitae suscipit est
3. Nulla tempor lobortis orci
Result:
- Sed sagittis eleifend rutrum
- Donec vitae suscipit est
- Nulla tempor lobortis orci
Method | Description |
---|---|
GET |
Fetch resource |
PUT |
Update resource |
DELETE |
Delete resource |
Footnotes in a text: Lorem ipsum1 dolor sit amet, consectetur adipiscing elit.2
- –
.icons/material/account-circle.svg
- :fontawesome-regular-laugh-wink: –
.icons/fontawesome/regular/laugh-wink.svg
- :octicons-octoface-16: –
.icons/octicons/octoface-16.svg
- – Medium
Images↵
mkdocs-print-site-plugin
supports enumerating figure captions (which can be added easily using the img2fig plugin):
Lists↵
-
Vivamus id mi enim. Integer id turpis sapien. Ut condimentum lobortis sagittis. Aliquam purus tellus, faucibus eget urna at, iaculis venenatis nulla. Vivamus a pharetra leo.
-
Vivamus venenatis porttitor tortor sit amet rutrum. Pellentesque aliquet quam enim, eu volutpat urna rutrum a. Nam vehicula nunc mauris, a ultricies libero efficitur sed.
-
Morbi eget dapibus felis. Vivamus venenatis porttitor tortor sit amet rutrum. Pellentesque aliquet quam enim, eu volutpat urna rutrum a.
- Mauris dictum mi lacus
- Ut sit amet placerat ante
- Suspendisse ac eros arcu
-
Lorem ipsum dolor sit amet
- Sed sagittis eleifend rutrum. Donec vitae suscipit est. Nullam tempus tellus non sem sollicitudin, quis rutrum leo facilisis.
Cras arcu libero
-
Aliquam metus eros, pretium sed nulla venenatis, faucibus auctor ex. Proin ut eros sed sapien ullamcorper consequat. Nunc ligula ante.
Duis mollis est eget nibh volutpat, fermentum aliquet dui mollis. Nam vulputate tincidunt fringilla. Nullam dignissim ultrices urna non auctor.
- Lorem ipsum dolor sit amet, consectetur adipiscing elit
- Vestibulum convallis sit amet nisi a tincidunt
- In hac habitasse platea dictumst
- In scelerisque nibh non dolor mollis congue sed et metus
- Praesent sed risus massa
- Aenean pretium efficitur erat, donec pharetra, ligula non scelerisque
The homomorphism \(f\) is injective if and only if its kernel is only the singleton set \(e_G\), because otherwise \(\exists a,b\in G\) with \(a\neq b\) such that \(f(a)=f(b)\)00.
Dummy section↵
This section has an incoming anchor link, at the top of this page
Some lorem ipsum↵
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut eget mi lacinia arcu ultrices rutrum eget a lacus. Etiam erat mi, sodales at nisl vel, bibendum tempor nunc. Cras in ultrices augue. Cras aliquam in mauris et semper. In hac habitasse platea dictumst. Proin dignissim scelerisque risus, consectetur ornare justo ultrices eu. Quisque tempus, elit eu ullamcorper interdum, metus augue pulvinar lectus, nec dictum mi dolor non turpis. Sed condimentum vulputate pretium.
Nulla at nisl tortor. Praesent vitae turpis sit amet sem condimentum fermentum eget nec dolor. Maecenas et imperdiet ante, at ultrices orci. Nunc ornare sodales enim. Sed tempor vitae mi et faucibus. Nunc aliquam est sit amet mauris tempus varius. Aenean blandit vel nibh nec sagittis. Sed vehicula nunc a nunc vehicula viverra. Proin risus justo, ullamcorper ac sem a, vulputate ornare justo. Sed facilisis pharetra elit, vitae dignissim nibh iaculis eu. Suspendisse potenti. Curabitur quis arcu ac est faucibus suscipit vel non lacus.
Ut tincidunt sapien sed sem auctor, et pellentesque erat tristique. Nunc porttitor lacus diam, eu malesuada nibh venenatis in. Donec sit amet enim eget enim facilisis placerat nec eget tortor. Etiam imperdiet, felis ac posuere dignissim, nulla sapien auctor mauris, ac aliquam orci leo nec dui. Donec efficitur turpis quis enim efficitur, eu ornare nisi consectetur. Sed ac arcu at orci pretium lobortis luctus non augue. Duis posuere purus at semper fringilla. Pellentesque facilisis libero vestibulum elit varius iaculis. Donec dapibus pretium scelerisque.
Suspendisse non orci vitae lorem placerat pretium vitae a ex. Nunc facilisis aliquam risus in vehicula. Fusce sodales bibendum lectus id ultricies. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In cursus blandit quam ac bibendum. Interdum et malesuada fames ac ante ipsum primis in faucibus. Ut commodo tellus vel interdum vulputate. Nulla in turpis tellus. Mauris at semper ex. Nulla varius leo eu libero placerat, quis euismod orci euismod. Phasellus pulvinar ut sapien nec elementum. Maecenas vel mi eros. Interdum et malesuada fames ac ante ipsum primis in faucibus. Phasellus volutpat massa vel purus interdum imperdiet. Curabitur congue turpis eget faucibus varius. Aenean eleifend placerat lorem vel vestibulum.
Nullam in posuere urna. Sed cursus est porta maximus dignissim. Etiam id ante libero. Curabitur ac rhoncus turpis. Cras eu ipsum lacus. Aliquam ac rutrum elit. Donec pharetra in arcu feugiat interdum. Nam sed libero semper, sollicitudin urna vel, tincidunt nulla. Curabitur dapibus massa lectus, vulputate fermentum est finibus et. Ut efficitur velit nec justo varius tempor. Nullam aliquet commodo enim eget lobortis. Nullam sit amet nunc viverra, iaculis sem non, scelerisque mauris. Vivamus eu finibus lacus, dignissim luctus elit.
Contribution Guidelines↵
Thanks for considering to contribute to this project! Some guidelines:
- Go through the issue list and if needed create a relevant issue to discuss the change design. On disagreements, maintainer(s) will have the final word.
- You can expect a response from a maintainer within 7 days. If you haven’t heard anything by then, feel free to ping the thread.
- This package tries to be as simple as possible for the user (hide any complexity from the user). Options are only added when there is clear value to the majority of users.
- When issues or pull requests are not going to be resolved or merged, they should be closed as soon as possible. This is kinder than deciding this after a long period. Our issue tracker should reflect work to be done.
Unit Tests↵
Make sure to install an editable version before running tests:
pip install -r tests/test_requirements.txt
pip install -e .
pytest --cov=mkdocs_print_site_plugin --cov-report term-missing tests/
If it makes sense, writing tests for your PRs is always appreciated and will help get them merged.
In addition, this project uses pyflakes for static code checking:
pip install pyflakes
pyflakes tests/ mkdocs_print_site_plugin/
Manual testing↵
To quickly serve a website with your latest changes to the plugin use the sites in our tests suite. For example:
pip install -r tests/test_requirements.txt
pip install -e .
mkdocs serve -f tests/fixutures/basic/mkdocs.yml
Tip: If you use google chrome, you can also view the print version of a page inside the browser by setting the renderer.
Code Style↵
Make sure your code roughly follows PEP-8 and keeps things consistent with the rest of the code. I recommended using black to automatically format your code.
We use google-style docstrings.
Documentation↵
Is in docs/
. To deploy the docs, run:
mkdocs gh-deploy
Note: there is no automated github action for this currently.