Skip to main content

Module mkdocs_extensions

Module mkdocs_extensions 

Source
Expand description

MkDocs PyMdown extensions support

This module provides support for various PyMdown Markdown extensions commonly used with MkDocs Material:

  • InlineHilite: Inline code highlighting `#!python code`
  • Keys: Keyboard key notation ++ctrl+alt+delete++
  • Caret: Superscript and insert ^superscript^ and ^^insert^^
  • Tilde: Subscript and strikethrough ~subscript~ and ~~strike~~
  • Mark: Highlight text ==highlighted==
  • SmartSymbols: Auto-replace symbols (c)©

§Architecture

All markup detection follows a consistent span-based pattern:

  1. find_*_spans(line) -> Vec<(usize, usize)> - find byte ranges
  2. is_in_*(line, position) -> bool - check if position is inside markup

For double-takes-precedence patterns (caret: ^^/^, tilde: ~~/~):

  • Double-delimiter spans are found first
  • Single-delimiter spans exclude positions inside double spans

§References

Functions§

is_in_mark
Check if a position is within mark markup
is_in_pymdown_markup
Check if a position is within any PyMdown extension markup
is_inline_hilite_content
Check if code span content starts with InlineHilite shebang