叶子的自定义标题ID。

foliantcontrib.customids的Python项目详细描述


自定义项

custom ids是一个预处理器,它允许在使用mkdocs或另一个提供html输出的后端构建的项目中使用pandoc样式语法,为标记源中的标题定义自定义标识符(id)。这些id可用于指向页面特定部分的超链接。

安装

$ pip install foliantcontrib.customids

用法

要启用预处理器,请将customids添加到项目配置中的preprocessors部分:

preprocessors:-customids

预处理器支持以下选项:

-customids:stylesheet_path:!pathcustomids.csstargets:-pre-mkdocs-site-ghp

stylesheet_path :css样式表文件的路径。此样式表应定义.custom_id_anchor_container.custom_id_anchor_container_level_N.custom_id_anchor.custom_id_anchor_level_N类的规则。这里的N是标题级别(16)。默认路径是customids.css。如果样式表文件不存在,将使用默认内置样式表。

targets :预处理器允许的目标。如果未指定(默认情况下),预处理器将应用于所有目标。

可以在同一行的标题内容之后指定自定义ID标记语法示例:

# First Heading {#custom_id_for_first_heading}

A paragraph.

## Second Heading {#custom_id_for_second_heading}

Some another paragraph.

此标记源代码最终将转换为HTML代码:

<divclass="custom_id_anchor_container custom_id_anchor_container_level_1"><divid="custom_id_for_first_heading"class="custom_id_anchor custom_id_anchor_level_1"></div></div><h1>First Heading</h1><p>A paragraph.</p><divclass="custom_id_anchor_container custom_id_anchor_container_level_2"><divid="custom_id_for_second_heading"class="custom_id_anchor custom_id_anchor_level_2"></div></div><h2>Second Heading</h2><p>Some another paragraph.</p>

(请注意,customids预处理器不会将标记语法转换为html;它只将html标记<div class="custom_id_anchor_container">...</div>插入标记代码。)

自定义标识不能包含空格和非ascii字符。

引用自定义ID的超链接示例:

[Link to Heading 1](#custom_id_for_first_heading)

[Link to Heading 2 in some document at the current site](/some/page/#custom_id_for_second_heading)

[Link to some heading with custom ID at an external site](https://some.site/path/to/the/page/#some_custom_id)

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

推荐PyPI第三方库


热门话题
java是地图。size()始终与map相同。entrySet()。大小()   java如何使用全局二级索引的分区键更新项   java AutoCompleteTextView背景/前景颜色   java线程、MediaPlayer、ProgressDialog和上下文问题   java为什么我不能制作这个minecraft mod?   java安卓如何从片段调用的Activity类启动新活动   java从一个数据库读取值并将其写入另一个数据库   java如何在运行时调整log4j级别?   shell停止将命令行参数中的通配符扩展为Java   java调用外部类变量是线程安全的吗?   groovy无法通过在Wildfly中使用Camel CDI在Java中执行Grrovy脚本来解决类问题   java如何修复NoSuchMethodError:“void freemaker”。样板配置<无法排除旧版本时初始化>(freemarker.template.Version)?   Java串行通信IllegatStateException端口已关闭   java禁止创建。兽人。crc文件   java Servlet会话失效   java如何在arraylist中计算最小距离   java JSlider可调整高分辨率屏幕的大小   java HashMap有containsValue方法,但没有getValue方法