允许生成mkdocs文档的pdf版本。

mkpdfs-mkdocs的Python项目详细描述


mkdocs的mkpdfsBuild Status

这是一个mkdocs插件,可以将文档导出到一个pdf文件中

MkPDFs for MkDocs

mkpdfs插件将使用WeasyPrint将mkdocs存储库中的文档导出为pdf文件。

与其他定制生成pdf的设计很复杂的插件不同,这个插件带来了完全控制生成pdf的设计的能力。

这个插件的特殊之处在于:

  1. 您的文档将作为单个pdf文件导出
  2. 页面顺序符合mkdocs配置文件中定义的导航
  3. 能够覆盖默认设计,使其满足您的需要
  4. 从生成的pdf中排除某些文件的能力
  5. 无布局问题
  6. 与主题设计没有冲突
  7. 集成在pdf中的目录

要求

  1. 此软件包需要mkdocs 1.0版
  2. python 3.4或更高版本
  3. weasyprint依赖于cairo、pango和gdk pixbuf,它们需要单独安装。请仔细遵循平台安装说明:

限制

如果使用的生成页面内容未包含在<article>标记或具有属性role="main"<div>标记中,则不会创建文档的pdf版本。

安装

pip

安装包
pip3 install mkpdfs-mkdocs

mkdocs.yml中启用插件,如下所示

plugins:-search-mkpdfs

或使用选项

plugins:-search-mkpdfs:-company:The War Company Inc.-author:Monsieur Silvestre

Note: If you enable this plugin and you don't have plugins entry in your MkDocs config file yet, you will need to explicitly enable the search plugin. This plugin is enabled by default when no plugins entry is set.

您可以在MkDocs documentation中找到有关插件的更多信息。

它是如何工作的?

使用mkdocs buildmkdocs serve生成或提供文档时,如果一切顺利,将显示以下消息:

The PDF version of the documentation has been generated.

选项

此插件支持以下选项,以便更好地处理生成的pdf的自定义。

OptionDescription
^{}The author of the document. This information will be printed on the cover page of the generated PDF.
^{}If this documentation is from a company, then you should provide this information. It will be displayed on the front page of the documentation, bellow the author information
^{}The table of content title. The default value is Table of Contents
^{}The position of the table of contents. This option supports 3 differents values: ^{} to put the toc at the beginning of the file but after the cover (*the default value), ^{} to put it at the end of the file or ^{} to not generate it at all.
^{}The file name of the generated PDF, relative to the ^{}. By default this location is set to ^{}
^{}Relative to your ^{}, this option is the location of the CSS file defining the layout of the generated PDF. If this option is not defined the default design will be used. Defining an non existing file will cause the build or serve failure.

贡献

从报告一个bug到提交一个pull请求,每一个贡献都是值得赞赏和欢迎的。使用Github issues报告错误、提问和请求功能。

感谢

这个插件的想法是在公共部门的一个项目中提出的。经过多次研究,我找到了一些插件,引导我找到当前的解决方案。他们给了我很多灵感,非常感谢:

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java为什么参数。getType()。isInstance(HttpServletRequest.class)返回值为false,但use“==”为true   使用Java的文本文件中的简单列表   linux Java创建具有特定所有者(用户/组)的文件和目录   java我试图解析一个文本文件,以计数唯一字符串的数量,并打印一些关于这些字符串的信息   雅加达ee如何使用JavaEE6@Resource注释   java从数据库中获取所有值,并将其存储在字符串数组中   java需要ArrayList中的单个数组   java变量id可能未使用lombok初始化Spring引导控制器   JavaS3客户端。读取超过文件大小时的GetObject行为   java在另一个活动列表视图中显示JSONObject   java spring引导fat jar注册到带有奇怪端口的eureka   java如何与mongoDB建立Android Studio连接?   java LinkedIn OAuth2/oauth/v2/accessToken响应未返回“令牌类型”   java如何在jtree中只列出非隐藏和非系统文件   Mybatis批量将Java BigDecimal插入SQL Server decimal(18,2)无法正常工作   java Hibernate Criteria Builder:如何按可为空的实体属性进行筛选?   如果涉及方法内变量的范围,python与java是否不同?   java如何实现web服务客户端,该客户端通过基于NTLM身份验证的身份验证连接到外部web服务   java使Jackson在反序列化期间无法将double转换为int