InlineHilite Extension

Syntax highlighting for inline code elements


taiseiue | 2024-12-16

Supported Versions:>=2.12

概要

The InlineHilite extension allows you to add syntax highlighting to Markdown inline code.

In a paragraph, by writing `:::language code`, the code will have inline highlighting corresponding to the language.

This syntax is implemented by PyMdown Extensions. For more information on the syntax, see InlineHilite - PyMdown Extensions Documentation.

Example

Example

To import a module in Python, use the statement `:::py3 import`.
For example, to import a `sys` module, write `:::py3 import sys`.

Example

To import a module in Python, use the statement import. For example, to import a sys module, write import sys.

導入方法

Add the following line to mkdocs.yml in the site

mkdocs.yml
markdown_extensions:
  - pymdownx.highlight:
      anchor_linenums: true
      line_spans: __span
      pygments_lang_class: true
  - pymdownx.inlinehilite
  - pymdownx.snippets
  - pymdownx.superfences