Giter Site home page Giter Site logo

timvink / mkdocs-print-site-plugin Goto Github PK

View Code? Open in Web Editor NEW
118.0 4.0 19.0 1.75 MB

MkDocs Plugin that adds an additional page that combines all pages, allowing easy exports to PDF and standalone HTML.

Home Page: https://timvink.github.io/mkdocs-print-site-plugin/

License: MIT License

CSS 22.72% Python 70.13% JavaScript 5.58% Smarty 1.57%
mkdocs mkdocs-plugin pdfs pdf print

mkdocs-print-site-plugin's Introduction

Actions Status PyPI - Python Version PyPI PyPI - Downloads codecov GitHub contributors PyPI - License

mkdocs-print-site-plugin

MkDocs plugin that adds a print page to your site that combines the entire site, allowing for easy export to PDF and standalone HTML. See demo.

Features 🌟

  • Support for mkdocs-material theme, including features like instant loading and dark color themes.
  • Support for pagination in PDFs.
  • Many options to customize appearance
  • Option to add a cover page
  • Lightweight, no dependencies.

Setup

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 the search plugin. MkDocs enables it by default if there is no plugins entry set.

Usage

  • Navigate to /print_page/ or print_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)

Documentation

Available at timvink.github.io/mkdocs-print-site-plugin.

Contributing

Contributions are very welcome! Start by reading the contribution guidelines.

mkdocs-print-site-plugin's People

Contributors

arterm-sedov avatar kludex avatar lambrechts avatar oprypin avatar rrcoder avatar timvink avatar tuunit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mkdocs-print-site-plugin's Issues

How to deal with multi-level documents? — Image links

I'm trying to use mkdocs-print-site-plugin on a multi-level document.

The structure is:

Capture 2020-10-04 à 11 51 23

The Chapter 1 - Section 1 page contains

# Chapter 1 - Section 1

## Part 1

This is a test.The installation of embedXcode includes 3 basic steps and an optional one:

+ Step 1 :fontawesome-solid-link:

+ Step 2 :fontawesome-solid-external-link-alt:

![](img/Picture1-1.png)

The Chapter 1 - Section 1 page renders as

Capture 2020-10-04 à 11 58 45

but with Print site,

  • First level headers are omitted from the TOC, here Chapter 1

Capture 2020-10-04 à 11 57 25

  • Picture1-1.png is not found.

Capture 2020-10-04 à 11 51 54

How to deal with multi-level documents? Thank you for your help!

Compatibility with `enumerate-headings` plugin

When using mkdocs-enumerate-headings-plugin, a number of issues appear:

  • enumerate-headings complains about print_site.md not having a h1 heading
  • enumerate-headings keeps counting headings also in the print page. The print page should re-use the numbered headings

plugin.py does not find mkdocs_print_site_plugin/css directory

Hi!

After installing mkdocs-print-site 0.5 version and running mkdocs build the following error appears:

Traceback (most recent call last):
  File "/workenv/user/.conda/envs/orchestrator_docs/bin/mkdocs", line 11, in <module>
    sys.exit(cli())
  File "/home/user/.local/lib/python3.6/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/user/.local/lib/python3.6/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/user/.local/lib/python3.6/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/user/.local/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/sw82tc/.local/lib/python3.6/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/user/.local/lib/python3.6/site-packages/mkdocs/__main__.py", line 152, in build_command
    build.build(config.load_config(**kwargs), dirty=not clean)
  File "/home/user/.local/lib/python3.6/site-packages/mkdocs/commands/build.py", line 236, in build
    config = config['plugins'].run_event('config', config)
  File "/home/user/.local/lib/python3.6/site-packages/mkdocs/plugins.py", line 94, in run_event
    result = method(item, **kwargs)
  File "/home/user/.local/lib/python3.6/site-packages/mkdocs_print_site_plugin/plugin.py", line 60, in on_config
    if file in os.listdir(os.path.join(HERE, "css")):
FileNotFoundError: [Errno 2] No such file or directory: '/home/user/.local/lib/python3.6/site-packages/mkdocs_print_site_plugin/css'

Python version is:

$ python -V
Python 3.6.2 :: Continuum Analytics, Inc.

mkdocs version is:

$ pip list | grep mkdocs
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
mkdocs (1.1.2)
mkdocs-awesome-pages-plugin (2.2.1)
mkdocs-enumerate-headings-plugin (0.4.1)
mkdocs-git-authors-plugin (0.3.2)
mkdocs-git-revision-date-localized-plugin (0.7)
mkdocs-material (5.5.12)
mkdocs-material-extensions (1.0)
mkdocs-minify-plugin (0.3.0)
mkdocs-pdf-export-plugin (0.5.8)
mkdocs-print-site-plugin (0.5)
mkdocs-table-reader-plugin (0.4.2)
mkdocstrings (0.13.1)

and the plugins included in mkdocs.yml are added in the following order:

plugins:
    - minify:
        minify_html: true
    - git-revision-date-localized:
        type: timeago
    - git-authors:
        show_contribution: True
    - table-reader
    - enumerate-headings
    - awesome-pages
    - pdf-export:
        verbose: true
        media_type: print
        combined: true
        enabled_if_env: ENABLE_PDF_EXPORT
    - search
    - mkdocstrings:
        default_handler: python
        handlers:
            python:
                rendering:
                    show_source: true
        watch:
            - src/orchestrator
    - print-site

Could you help me?

Thanks!

links in pdf not working

When creating pdf using mkdocs-print-site-plugin, the links are not working.
The following are the mkdocs package versions :

mkdocs == 1.1.2
mkdocs-awesome-pages-plugin == 2.4.0
mkdocs-enumerate-headings-plugin ==0.4.3
mkdocs-git-authors-plugin ==0.3.2
mkdocs-git-revision-date-localized-plugin 0.7.3
mkdocs-img2fig-plugin==0.9.3
mkdocs-material ==6.1.0
mkdocs-material-extensions ==1.0
mkdocs-minify-plugin==0.3.0
mkdocs-pdf-export-plugin==0.5.8
mkdocs-print-site-plugin== 0.8.2
mkdocs-table-reader-plugin == 0.4.1

Absolute image paths are overwritten

Problem

I've got an issue with absolute image paths. Images with an absolute path (e.g. /im/test.png) are turned into (.//im/test.png), which results in errors because the path is invalid and images cannot be found.

Cause

The error caused by these lines of urls.py:

if directory_urls:
new_url = '../' + new_url

Proposed Fix

Replace
new_url = '../' + new_url
with
new_url = os.path.join('../', new_url)
to prevent absolute paths from being overwritten.

Add option for front cover page

Add the option to have the first page be a nice full cover title. With on it at least the site title, We could even use mkdocs-git-authors-plugin to add all unique authors and last updated date when available

Here's how it could be done using CSS:
http://blog.michaelperrin.fr/2019/11/04/printing-the-web-part-2-html-and-css-for-printing-books/

Users might want some more flexibility, perhaps being able to edit/add a template .tpl file could be a good approach (example use in another plugin here https://github.com/wilhelmer/mkdocs-multirepo)

How to deal with multi-level documents? — Internal links

Derived from #17 and based on same minimal test I am using to evaluate Print Site.

Page Chapter 2 - Section 1 contains an internal link to Chapter 1 - Section 1

# Chapter 2 - Section 1

## Index 1

### Index 1-1

Id | Name
--- | ---
1 | One
2 | Two

### Index 1-2

Internal link to [Chapter 1 - Section 1](../../Chapter1/Section1)

Calling the link from page Chapter 2 - Section 1 works fine, but not from the Print Site page.

Obviously, the internal links on the Print Site page should stay within the same page.

The targeted section on the Print Site page is #chapter1-section1-chapter-1-section-1 as generated on the TOC on top of the Print Site page.

<section class="print-page" id="chapter1-section1">
  <h1 id="chapter1-section1-chapter-1-section-1">Chapter 1 - Section 1<a class="headerlink"  href="#chapter1-section1-chapter-1-section-1" title="Permanent link">&para;</a>
  </h1>
// ...
</section>

However, the generated internal link is

<p>Internal link to <a  href="#..-..-Chapter1-Section1">Chapter 1 - Section 1</a></p>

and should be

<p>Internal link to <a  href="#chapter1-section1-chapter-1-section-1">Chapter 1 - Section 1</a></p>

`fix_internal_links` only fixes pages and images, but not attachments

One of my documentation websites offers internal links to Python scripts, text files and spreadsheets. Downloading those files work as expected from the MkDocs website.

The corresponding links get converted to anchors by mkdocs-print-site-plugin, though, and cannot be accessed anymore from the print_page or the resulting PDF.

For example, in Markdown:

[`hello.py`](../attachments/scripts/hello.py){target=_blank}

gets converted by MkDocs to:

<a href="../../attachments/scripts/hello.py" target="_blank"><code>hello.py</code></a>

and then by mkdocs-print-site-plugin:

<a href="#attachments-scripts-hello.py" target="_blank"><code>hello.py</code></a>

But this anchor doesn't exist.

Could it be possible to fix the resulting urls, like, AFAICT, fix_image_src does for images?

One quick-and-dirty fix I found is to modify https://github.com/timvink/mkdocs-print-site-plugin/blob/master/mkdocs_print_site_plugin/urls.py#L100 in order to consider those attachments as external url:

    if is_external(url) or url.endswith('.py') or url.endswith('.xlsx') or url.endswith('.txt'):
        continue

It might be a good idea to also apply add_full_urls: true to those attachments, so that the corresponding files can still be found even when the documentation is printed to paper.

Option to enable / disable plugin

Since for large docs it takes some time (like minute or more) and if you are real time serving that slows down refresh.

It could be good to be able to enable/disable plugin by boolean option. Since mkdocs supports setting config values via Environment variables in next version (mkdocs/mkdocs#1954) this could be set up dynamically depending on needs.

Multi-times TOC are generated repeatly when markdown file has html included

Hi owners,

Thanks for the excellent plugin. I just found my table of contents are generated many times in my print page.

After debug, I found it caused by my including html several times as mkdocs supported:

--8<-- "./table_7.html"

And this plugin replace simply. This results generate_toc() called several times.
A possible fix will be only replace the last due to the previously ones may be included by html file.

Update docs to explain how to automate building PDFs

mkdocs-print-site-plugin's main feature is to combine all site pages into a single page. Initially, the idea was that users of the website could create the PDF themselves in their own browser.

We could automate the PDF building as well, using a headless chrome plugin. Either via python or via node.js (like @majkinetor did in https://github.com/majkinetor/mm-docs-template/blob/master/source/pdf/print.js).

I'd like to update the docs with a page showing code examples of how to do this.

Compatibility with mkdocstrings

table of contents and output in PDF seem kind of garbled for output of mkdocstrings plugin.

  • Build a small example to try and replicate
  • See if there are any stylings that could fix this.

image

Generate page with Table of Contents without content of articles

Is it possible to generate only page with contents but without content of articles to use it as sitemap?

Such feature can be very useful

My suggestion is to add some option like show_content

plugins:
  - print-site:
      add_to_navigation: true
      print_page_title: 'Site map'
      add_table_of_contents: true
      toc_title: 'Table of Contents'
      toc_depth: 6
      add_full_urls: true
      show_content: false

Create PDF bookmarks (table of contents in a PDF)

When creating PDFs using tools like weasyprint, it also creates a nice table of contents inside the PDF.

However, when printing using Chrome > File > Print > Save as PDF, it does not.

Apparently, there is this CSS standard that allows specifying these bookmarks using bookmark-level. print-css.rocks also has a CSS lesson on pdf-bookmarks. I copied code from both examples to print_page.css:

https://github.com/timvink/mkdocs-print-page-plugin/blob/af1e62fd1402707b369250af157376f962203d48/mkdocs_print_site_plugin/css/print_site.css#L19-L30

No success yet. Help here would be appreciated!

error on start

Hello,

I want to try your PHP export module but got an error when tryin to launch in local the mkdocs serve:

INFO    -  Building documentation...
INFO    -  Cleaning site directory
Traceback (most recent call last):
  File "/home/xx/.local/bin/mkdocs", line 10, in <module>
    sys.exit(cli())
  File "/home/xx/.local/lib/python3.7/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/xx/.local/lib/python3.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/xx/.local/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/xx/.local/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/xx/.local/lib/python3.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/xx/.local/lib/python3.7/site-packages/mkdocs/__main__.py", line 136, in serve_command
    **kwargs
  File "/home/xx/.local/lib/python3.7/site-packages/mkdocs/commands/serve.py", line 141, in serve
    config = builder()
  File "/home/xx/.local/lib/python3.7/site-packages/mkdocs/commands/serve.py", line 136, in builder
    build(config, live_server=live_server, dirty=dirty)
  File "/home/xx/.local/lib/python3.7/site-packages/mkdocs/commands/build.py", line 295, in build
    config['plugins'].run_event('post_build', config=config)
  File "/home/xx/.local/lib/python3.7/site-packages/mkdocs/plugins.py", line 96, in run_event
    result = method(**kwargs)
  File "/home/xx/.local/lib/python3.7/site-packages/mkdocs_print_site_plugin/plugin.py", line 192, in on_post_build
    self.print_page.content = self.renderer.write_combined()
  File "/home/xx/.local/lib/python3.7/site-packages/mkdocs_print_site_plugin/renderer.py", line 76, in write_combined
    html += get_html_from_items(self.items, dir_urls = self.mkdocs_config.get('use_directory_urls'))
  File "/home/xx/.local/lib/python3.7/site-packages/mkdocs_print_site_plugin/renderer.py", line 69, in get_html_from_items
    item_html += get_html_from_items(item.children, dir_urls)
  File "/home/xx/.local/lib/python3.7/site-packages/mkdocs_print_site_plugin/renderer.py", line 69, in get_html_from_items
    item_html += get_html_from_items(item.children, dir_urls)
  File "/home/xx/.local/lib/python3.7/site-packages/mkdocs_print_site_plugin/renderer.py", line 66, in get_html_from_items
    item_html += fix_internal_links(item.html, item.url, directory_urls=dir_urls)
  File "/home/xx/.local/lib/python3.7/site-packages/mkdocs_print_site_plugin/urls.py", line 149, in fix_internal_links
    assert len(url_paths) <= 2
AssertionError`
  • mkdocs.yml:
site_name: "doc"
site_description: 'x'
site_author: 'xx'
site_url: 'https://xx'

# Configuration
theme:
  name: material
  language: 'fr'
  features:
    - navigation.tabs
  palette:
    primary: 'white'
    accent: 'Deep orange'
  font:
    #text: 'Rubik'
    #text: 'Yatra One'
    text: 'Karla'
    code: 'Karla Regular'
  icon:
    logo: material/library
    repo: fontawesome/brands/git-alt

# Customization
plugins:
  - search
  - print-site
extra_javascript:
    - https://unpkg.com/[email protected]/dist/mermaid.min.js
markdown_extensions:
  - markdown.extensions.admonition
  - markdown.extensions.attr_list
  - markdown.extensions.codehilite:
      guess_lang: false
  - markdown.extensions.def_list
  - markdown.extensions.footnotes
  - markdown.extensions.meta
  - markdown.extensions.toc:
      permalink: true
  - pymdownx.arithmatex
  - pymdownx.betterem:
      smart_enable: all
  - pymdownx.caret
  - pymdownx.critic
  - pymdownx.details
  - pymdownx.emoji:
      emoji_index: !!python/name:materialx.emoji.twemoji
      emoji_generator: !!python/name:materialx.emoji.to_svg
        # - pymdownx.highlight:
      #     linenums_style: pymdownx-inline
  - pymdownx.inlinehilite
  - pymdownx.keys
  - pymdownx.magiclink:
      repo_url_shorthand: true
      user: squidfunk
      repo: mkdocs-material
  - pymdownx.mark
  - pymdownx.smartsymbols
  - pymdownx.snippets:
      check_paths: true
  - pymdownx.superfences
  - pymdownx.tabbed
  - pymdownx.tasklist:
      custom_checkbox: true
  - pymdownx.tilde

Thanks for your help.

do-not-print class

Sometimes you might have elements you do not want to print.

Using the attr markdown extension, we could add a custom class that sets display: none on @print.

How to deal with multi-level documents? — Suggestion for granularity

Derived from #17 and based on same minimal test I am using to evaluate Print Site.

This is a suggestion, not an issue.

Up to now, the Print Site plug-in generates one single file for the whole site —hence its name.

As a suggestion, could we consider a file per top sections?

In the case of the example, there would be one file for the Chapter1 top section and another for the Chapter2 one.

On the TOC, each section would have its own Print Section page, ie. Chapter1 > Print Section and Chapter2 > Print Section.

Ill table formatting

Hi, thank you for the cool library!

I've encountered some table formatting issues.

  1. table which is smaller than one page: first page is just left blank
    grafik

  2. table which is bigger than one page: first page is filled properly, but table headers are displayed twice
    grafik

TOC parameters and improvements

Consider adding the following ToC parameters:

toc_title: 'Table of Contents'
toc_depth: 1  #level

Depth could be used to produce less spammy TOC, containing for example only navigation section without page TOC.

TOC also includes ↵ symbol and has non linked entries (those that are 'level 2' or higher):

non linked entries

image

I have this in mkdocs.yaml

markdown_extensions:
    - toc:
        permalink: ↵

I guess it should be removed from the links.

Regarding non-linked 2nd level entries, I can hide those with .toc-nav-section-title-level-2 {display none} etc.

Content is cut off when printing (pymdownx.details enabled)

I'm using the PyMardkown extensions with the MKDocs Material theme and the print-site plugin. I've discovered that when I enable the pymdownx.details extension, the print formatting gets messed up and truncated on the left side (see screenshot below).

I don't have the chops to quite track down how the extension changes the styling(?) or if it is related to a browser issue. I've only tried it with Chrome based browsers (Edge, Brave, Chrome). The PyMdown website notes that there may be browser issues and gives some code for a potential fix. I've tried using the code via extra css and extra javascript, but it doesn't seem to solve the issue.

This isn't a deal-breaker for me, but I just thought I'd post hit here in case others have similar trouble.

Screenshot 2021-03-26 105504

Add enumeration to figure captions

When you're writing technical reports, it's good practice to also number your figures.

The mkdocs-img2fig-plugin already makes it easy to add nice captions to your images.

It would be relatively easy to add enumeration to all <caption></caption> texts.

Error when activating the plugin

When I'm activating the plug-in (with the last updated version of the plugin) I have the following message error:

PermissionError: [Errno 13] Permission denied: '/tmp/print_page.md'

And I do not have this /tmp/print_page.md`file.

Here is the requirement.txt I'm working with for my virtual environment:

--find-links lib
pytest==4.4.1
click==7.0
pyhocon==0.3.55
matplotlib==3.1.1
seaborn==0.9.0
data-manager

mkdocs-material>=5.5.0
mkdocs-git-revision-date-localized-plugin>=0.7
mkdocs-git-authors-plugin>=0.3.2
mkdocs-table-reader-plugin>=0.4.1
mkdocs-enumerate-headings-plugin>=0.4.1
mkdocs-awesome-pages-plugin>=2.2.1
mkdocs-minify-plugin>=0.3.0
mknotebooks>=0.4.1
mkdocs-print-site-plugin>=0.3
mkdocs-img2fig-plugin

Anchors generated for relative links doesn't exist

Relative links are turned into anchors according to their relative paths, but in the print-page class, the section's id which acts as its anchor is generated according to the page's absolute path. This results in these links not working.

We patched this at the end of url.py by generating all relative anchors (this assumes all of them are unique across the entire site and the paths do not contain --s:

    # Finally, insert new anchor for each page
    page_key_parts = page_key.split('-')
    for k in range(len(page_key_parts)):
        partial_page_key = '-'.join(page_key_parts[k:])
        html = f'<section class="print-page" id="{partial_page_key}">{html}</section>'
    return html

Path to image in cover page

How to add images to the custom cover page?

A simple line like <img src="my_img.jpg" alt="My image"> inside a custom_cover_page.tpl might work, but I did not find the right path to the image.

Image path broken with img2fig plugin

If I additionally use the mkdocs-img2fig-plugin, then I get enumerated figures as expected, but now the figure links are broken. I get issues like

WARNING - 404 GET my_section/system/img/sys.png (127.0.0.1) 8.98ms

This path to the figure is not correct, the plugin has added the sub-folder "system" which does not exist (the figure sys.png lives in a markdown file called system.md, this is presumably where the additional folder name comes from).

In mkdocs.yml, the img2fig plugin is enabled before print-site.

Versions used:

  • Python 3.7.4
  • mkdocs==1.1.2
  • mkdocs-print-site-plugin==0.8.2
  • mkdocs-img2fig-plugin==0.9.3

Print preview only shows 2 pages

When I try to print the "Print Site" of my TMD, viewed in Firefox via mkdocs serve, I see only 2 pages (the 2nd is blank) in the print preview, unless I click the option to "Simplify Page". However, that strips a lot of the nice formatting, including all tables.

Describe in the docs how to add a PDF download button

Basically how to manually add a non-markdown file to the MkDocs site.

I envision the user pointing to the location of the PDF file in the config, and the plugin then taking care of adding the file and a page.pdf_url parameter to every page. Then you can overwrite a page content partial.

We could use the fontawesome icon file-pdf

<i class="fas fa-file-pdf"></i>

We add an extra config param pdf_url, with the relative url from the docs/ dir. All files in docs are copied over (link).

Just need to figure out the correct link to the file. Perhaps for each page find the os.path.dirname() of the url_relative_to() the index page. Maybe there's a variable with the homepage.

Enumerate headings using the nav structure

Your plugin is helpful and works fine, thanks for that!

There is one point I would like to suggest for enhancement (e.g. as an option to the existing method). I understand that your enumeration of headings is only based on the level of the markdown header, and ignores the nav structure from mkdocs.yml. In addition, your TOC has some visual-only features to reflect this nav structure (like the "Customization" title in https://timvink.github.io/mkdocs-print-site-plugin/print_page.html).

It would be more natural to me to consider the nav structure (and adjust the level of the header). For example, your "Customization" would create a # Customization (i.e. Section 3), and the subjacent pages would be included like ## Adding a print button (i.e. Section 3.1) or ## Adding a PDF button (i.e. Section 3.2).

Run theme switching in mkdocs-material only on print event

I prefer dark mode in mkdocs-material, and going to the print site page, it will switch to light mode (for printing purposes). I do this using javascript.

It looks like you can run bits of javascript only when printing: https://stackoverflow.com/a/11060206/5525118

This enables switching the color theme from dark to white only at the moment is it needed, keeping the print page in the nice dark theme as well, and in effect hiding this color theme switch from users.

PDF export is missing first pages

In latest version PDF export has truncated top.

This might be due to handling of TOC depth in newest version 1.1.0 but removing toc with add_table_of_contents: false still doesn't fix it (that is, sometimes it does, I guess it depends on the size of the doc).

Here are some screenshots - on all front page is missing and depending on TOC depth there are different outputs. Removing TOC doesn't fix front page problem.

screenshots

bug1

bug2

This is with latest material (v7.1.0)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.