### Alternate Tabbed Code Setup Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/tabbed.md This example demonstrates how to style tabs, add overflow indicators, and implement smooth scrolling for tabbed content. It requires HTML structure, CSS for styling and behavior, and optionally JavaScript for enhanced navigation indicators. ```html

Lorem ipsum ullamco ea aute do sint cupidatat elit nostrud exercitation dolore culpa aliquip nisi commodo nisi qui magna non laborum proident id voluptate in cupidatat duis.

Lorem ipsum ullamco ea aute do sint cupidatat elit nostrud exercitation dolore culpa aliquip nisi commodo nisi qui magna non laborum proident id voluptate in cupidatat duis.

Lorem ipsum ullamco ea aute do sint cupidatat elit nostrud exercitation dolore culpa aliquip nisi commodo nisi qui magna non laborum proident id voluptate in cupidatat duis.

``` ```css /* General environment setup */ html { background-color: black; height: 100%; } body { font-size: 120%; width: 20em; padding: 1em 2em; margin: 0 auto; background-color: white; height: 100%; } /* Tab style starts here */ .tabbed-alternate { position: relative; display: flex; flex-wrap: wrap; flex-direction: column; margin: 1em 0; border-radius: 0.1rem; } .tabbed-alternate > input { display: none; } .tabbed-labels { display: flex; width: 100%; overflow: auto; box-shadow: 0 -0.1rem #ddd inset; scrollbar-width: none; } .tabbed-labels::-webkit-scrollbar { display: none; } .tabbed-labels > label { width: auto; padding: 0.9375em 1.25em 0.78125em; font-weight: 700; font-size: 0.84em; white-space: nowrap; border-bottom: 0.1rem solid transparent; scroll-snap-align: start; border-top-left-radius: 0.1rem; border-top-right-radius: 0.1rem; cursor: pointer; ``` -------------------------------- ### Highlight Example with Custom Lexer Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/highlight.md Demonstrates using the custom 'php-inline' lexer for PHP code that does not start with ' 0, "bar" => 1);` ``` -------------------------------- ### Install Documentation Dependencies Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/about/development.md Install the necessary Python packages for building and previewing documentation. This command reads dependencies from the 'requirements/docs.txt' file. ```bash pip install -r requirements/docs.txt ``` -------------------------------- ### Install Project Requirements Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/about/development.md Install project dependencies required for testing. Ensure you have pip installed. ```bash pip install -r requirements/project.txt pip install -r requirements/extra.txt pip install -r requirements/test.txt ``` -------------------------------- ### Install Tox Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/about/development.md Install the Tox tool, which is used for automating testing in different virtual environments. Ensure you have pip installed. ```bash pip install tox ``` -------------------------------- ### Install Node.js Modules Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/about/development.md Install the required Node.js modules for frontend development, including theme editing and build processes. Ensure Node.js version >= 10 is installed. ```bash npm install ``` -------------------------------- ### Inline Highlighted Code Example Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/inlinehilite.md Demonstrates the syntax for inline highlighted code using mock shebangs. The `#!` syntax is shown, and an example of it being treated as literal text is also provided. ```text Here is some code: `#!py3 import pymdownx; pymdownx.__version__`. The mock shebang will be treated like text here: ` #!js var test = 0; `. ``` -------------------------------- ### PHP Inline Code Example Source: https://github.com/facelessuser/pymdown-extensions/blob/main/tests/extensions/superfences/superfences (preserve tabs).txt Demonstrates inline PHP code usage. ```php-inline $a = array("foo" => 0, "bar" => 1); ``` -------------------------------- ### Install Requests Library Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/about/development.md Install the Requests library using pip. This is a prerequisite for running the emoji generation script. ```bash pip install requests ``` -------------------------------- ### Minimum Block Extension Setup Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/blocks/api.md Provides the essential Python code for creating a custom Block and its corresponding BlocksExtension. ```python from pymdownx.blocks import BlocksExtension from pymdownx.blocks.block import Block import xml.etree.ElementTree as etree class MyBlock(Block): NAME = 'my-block' def on_create(self, parent): return etree.SubElement(parent, 'div') class MyBlockExtension(BlocksExtension): def extendMarkdownBlocks(self, md, block_mgr): block_mgr.register(MyBlock, self.getConfigs()) def makeExtension(*args, **kwargs): """Return extension.""" return MyBlockExtension(*args, **kwargs) ``` -------------------------------- ### Example Versioning Formats Source: https://github.com/facelessuser/pymdown-extensions/blob/main/SECURITY.md Illustrates common versioning formats adhering to PEP440. Use these formats when referencing project versions. ```plaintext 8.0 8.1 8.1.3 ``` -------------------------------- ### Manually Install PyMdown Extensions Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/installation.md These commands are used for a manual build and installation of PyMdown Extensions from source. ```bash $ python setup.py build $ python setup.py install ``` -------------------------------- ### Example with HTML wrapper Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/blocks/index.md Demonstrates using a block with an HTML wrapper, showing the structure of nested or complex block definitions. ```html //// html | div.result /// note | Did you know? You can create a note with Blocks! /// //// ``` -------------------------------- ### Example with HTML wrapper and YAML options Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/blocks/index.md Illustrates a block with an HTML wrapper that also includes YAML options for styling, demonstrating advanced block configuration. ```html //// html | div.result /// html | div attrs: {style: 'font-size: xx-large'} Some content. /// //// ``` -------------------------------- ### Tasklist Syntax Example Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/tasklist.md Demonstrates the syntax for creating task lists with checked and unchecked items, including nested lists and additional text. ```text Task List - [X] item 1 * [X] item A * [ ] item B more text + [x] item a + [ ] item b + [x] item c * [X] item C - [ ] item 2 - [ ] item 3 ``` -------------------------------- ### Initialize Caption Extension Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/blocks/plugins/caption.md Import the markdown library and initialize it with the Caption extension. This is the basic setup required to use the extension. ```python import markdown md = markdown.Markdown(extensions=['pymdownx.blocks.caption']) ``` -------------------------------- ### Example of Math Fences Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/arithmatex.md This is an example of a fenced math block using the `math` directive. ```text ```math \begin{align} p(v_i=1|\mathbf{h}) & = \sigma\left(\sum_j w_{ij}h_j + b_i\right) \\ p(h_j=1|\mathbf{v}) & = \sigma\left(\sum_i w_{ij}v_i + c_j\right) \end{align} ``` ``` -------------------------------- ### HTML Comment Example Source: https://github.com/facelessuser/pymdown-extensions/blob/main/tests/extensions/striphtml/striphtml (no attr strip).html Demonstrates how HTML comments are handled. This example shows a string containing an HTML comment. ```javascript var a = ""; // /\* \*/ h1 {color:red;} p {color:blue;} ``` -------------------------------- ### Critic Markup Example: Accept Mode Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/critic.md Demonstrates Critic Markup syntax for insertions, deletions, substitutions, highlighting, and comments when the 'accept' mode is enabled. This example shows how edits are processed and rendered. ```critic-markup Here is some {--*incorrect*--} Markdown. I am adding this{++ here++}. Here is some more {--text that I am removing--}text. And here is even more {++text that I am ++}adding.{~~ ~> ~~}Paragraph was deleted and replaced with some spaces.{~~ ~> ~~}Spaces were removed and a paragraph was added. And here is a comment on {==some text==}{>>This works quite well. I just wanted to comment on it.<<}. Substitutions {~~is~>are~~} great! General block handling. {-- * test remove * test remove * test remove * test remove * test remove --} {++ * test add * test add * test add * test add * test add ++} ``` ```md-render --- extensions: - pymdownx.critic extension_configs: pymdownx.critic: mode: accept --- Here is some {--*incorrect*--} Markdown. I am adding this{++ here++}. Here is some more {--text that I am removing--}text. And here is even more {++text that I am ++}adding.{~~ ~> ~~}Paragraph was deleted and replaced with some spaces.{~~ ~> ~~}Spaces were removed and a paragraph was added. And here is a comment on {==some text==}{>>This works quite well. I just wanted to comment on it.<<}. Substitutions {~~is~>are~~} great! General block handling. {-- * test remove * test remove * test remove * test remove * test remove --} {++ * test add * test add * test add * test add * test add ++} ``` -------------------------------- ### Example with HTML wrapper and raw content Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/blocks/index.md Shows an HTML wrapper containing a raw content block, highlighting how to handle content that should not be further processed by Markdown. ```html //// html | div.result /// html | pre Pre blocks are _raw_. Additional Markdown parsing is *avoided*. Content should be indented. /// //// ``` -------------------------------- ### Initialize Tabbed Extension Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/tabbed.md Import and initialize the markdown library with the Tabbed extension. This is the basic setup required to use the extension. ```python import markdown md = markdown.Markdown(extensions=['pymdownx.tabbed']) ``` -------------------------------- ### Git Graph Example Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extras/mermaid.md Use this for visualizing Git commit history. Define commits, branches, and merges. ```diagram gitGraph commit branch hotfix checkout hotfix commit branch develop checkout develop commit id:"ash" tag:"abc" branch featureB checkout featureB commit type:HIGHLIGHT checkout main checkout hotfix commit type:NORMAL checkout develop commit type:REVERSE checkout featureB commit checkout main merge hotfix checkout featureB commit checkout develop branch featureA commit checkout develop merge hotfix checkout featureA commit checkout featureB commit checkout develop merge featureA branch release checkout release commit checkout main commit checkout release merge main checkout develop merge release ``` -------------------------------- ### Initialize SuperFences Extension Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/superfences.md Include the SuperFences extension when initializing Python Markdown. No additional setup is required for basic functionality. ```python import markdown md = markdown.Markdown(extensions=['pymdownx.superfences']) ``` -------------------------------- ### Python Markdown Setup for InlineHilite Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/inlinehilite.md Shows how to include the InlineHilite extension when initializing the Python Markdown parser. ```py3 import markdown md = markdown.Markdown(extensions=['pymdownx.inlinehilite']) ``` -------------------------------- ### Example of Inline Math Block Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/arithmatex.md This shows the syntax for an inline math block using the `#!math` directive. ```text `#!math p(x|y) = \frac{p(y|x)p(x)}{p(y)}` ``` -------------------------------- ### Gantt Chart Example Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extras/mermaid.md Use this for project scheduling. Note that Gantt charts can be impractical due to rendering size limitations. ```diagram gantt dateFormat YYYY-MM-DD title Adding GANTT diagram to mermaid excludes weekdays 2014-01-10 section A section Completed task :done, des1, 2014-01-06,2014-01-08 Active task :active, des2, 2014-01-09, 3d Future task : des3, after des2, 5d Future task2 : des4, after des3, 5d ``` -------------------------------- ### State Diagram Example Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extras/mermaid.md Use this for representing the states and transitions of a system. Define states and transitions between them. ```diagram stateDiagram [*] --> First First --> Second First --> Third state First { [*] --> fir fir --> [*] } state Second { [*] --> sec sec --> [*] } state Third { [*] --> thi thi --> [*] } ``` -------------------------------- ### Pie Chart Diagram Example Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extras/mermaid.md Use this for displaying proportional data. Define slices and their values. ```diagram pie title Key elements in Product X "Calcium" : 42.96 "Potassium" : 50.05 "Magnesium" : 10.01 "Iron" : 5 ``` -------------------------------- ### Using Custom Registered Details Type Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/blocks/plugins/details.md Example of using a custom details type that has been registered via configuration. ```text /// some-custom-type | Some summary Some content /// ``` -------------------------------- ### Code Snippet with Tabs Source: https://github.com/facelessuser/pymdown-extensions/blob/main/tests/extensions/superfences/superfences (normal).html Example showing how tabs are handled within code blocks. ```text Test with tabs. Test with tabs. Test tabs. ``` ```text ============================================================ T Tp Sp D Dp S D7 T ------------------------------------------------------------ A F#m Bm E C#m D E7 A A# Gm Cm F Dm D# F7 A# B♭ Gm Cm F Dm E♭m F7 B♭ ``` -------------------------------- ### Basic Details Syntax Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/details.md Use '???' to start a details block. The summary text must be in quotes, and the content must be indented. A blank line is required before the block. ```markdown ??? optional-class "Summary" Here's some content. ??? multiple optional-class "Summary" Here's some content. ``` -------------------------------- ### Flowchart Diagram Example Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extras/mermaid.md Use this for creating flowcharts. It defines nodes and connections between them. ```diagram graph TD A[Hard] -->|Text| B(Round) B --> C{Decision} C -->|One| D[Result 1] C -->|Two| E[Result 2] ``` -------------------------------- ### Class Diagram Example Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extras/mermaid.md Use this for visualizing class structures, inheritance, and relationships. Define classes, attributes, methods, and associations. ```diagram classDiagram Class01 <|-- AveryLongClass : Cool Class03 *-- Class04 Class05 o-- Class06 Class07 .. Class08 Class09 --> C2 : Where am i? Class09 --* C3 Class09 --|> Class07 Class07 : equals() Class07 : Object[] elementData Class01 : size() Class01 : int chimp Class01 : int gorilla Class08 <--> C2: Cool label ``` -------------------------------- ### Basic Python Code Highlighting Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/superfences.md Demonstrates basic Python code highlighting using fenced code blocks. Ensure Pygments is installed for this to work. ```python import foo.bar ``` -------------------------------- ### Journey Diagram Example Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extras/mermaid.md Use this for illustrating user journeys or processes. Define sections and activities within them. ```diagram journey title My working day section Go to work Make tea: 5: Me Go upstairs: 3: Me Do work: 1: Me, Cat section Go home Go downstairs: 5: Me Sit down: 5: Me ``` -------------------------------- ### Initialize SaneHeaders Extension Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/saneheaders.md Import and initialize the markdown library with the 'pymdownx.saneheaders' extension. This is the basic setup required to enable the extension's functionality. ```python import markdown md = markdown.Markdown(extensions=['pymdownx.saneheaders']) ``` -------------------------------- ### Example of Delete Syntax Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/tilde.md Wrap text with double tildes (~~) to create a delete tag. The `smart_delete` option can enable more advanced behavior. ```text ~~Delete me~~ ``` -------------------------------- ### HTML Structure Example Source: https://github.com/facelessuser/pymdown-extensions/blob/main/tests/test_extensions/_snippets/section.txt A simple HTML snippet containing a div with a paragraph. This demonstrates basic HTML structure. ```html

content

``` -------------------------------- ### Roman Numeral List Ambiguity Example Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/fancylists.md Demonstrates how Roman numerals are parsed within alphabetical lists. Using 'v' in the middle of a Roman numeral list works, but starting a new list with 'v' results in an alphabetical list. ```markdown iii. item 3 iv. item 4 v. item 5 --- v. v w. w ``` -------------------------------- ### Serve Documentation Locally Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/about/development.md Build and serve the project documentation locally using Zensical. This command starts a development server, typically at 'localhost:8000', with live reloading for updated documents. ```bash python3 -m zensical serve -f zensical.yml ``` -------------------------------- ### EscapeAll Example Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/escapeall.md Demonstrates how EscapeAll escapes all characters, including spaces, punctuation, and Unicode symbols. This behavior is not applied within code blocks. ```text \W\e\ \c\a\n\ \e\s\c\a\p\e \e\v\e\r\y\t\h\i\n\g\!\ \❤\😄 ``` -------------------------------- ### Collapsible Callout Example Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/quotes.md Illustrates how to create a collapsible callout by adding '+' for open or '-' for closed immediately after the callout type specifier. ```text > [!danger]- Click to see more > I'm collapsible. ``` -------------------------------- ### Multiple Terms and Definitions HTML Output Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/blocks/plugins/definition.md This HTML output corresponds to the text-based example with multiple terms and definitions, showing how 'Apple' and 'Orange' are rendered. ```html //// define Apple - Pomaceous fruit of plants of the genus Malus in the family Rosaceae. Orange - The fruit of an evergreen tree of the genus Citrus. //// ``` -------------------------------- ### Example HTML for a Styled Progress Bar Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/progressbar.md This HTML snippet demonstrates how a progress bar might be rendered with specific classes and styles, including a title and a percentage. ```html

Goals


25%

``` -------------------------------- ### Example of Insert Syntax Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/caret.md Use double '^' characters to surround text that should be wrapped in an HTML tag. This feature can be further customized with the 'smart_insert' option. ```text ^^Insert me^^ ``` -------------------------------- ### UML Flow Chart Example Source: https://github.com/facelessuser/pymdown-extensions/blob/main/tests/extensions/superfences/superfences (preserve tabs).txt Example of a UML flow chart definition. ```flow st=>start: Start:>http://www.google.com[blank] e=>end:>http://www.google.com op1=>operation: My Operation sub1=>subroutine: My Subroutine cond=>condition: Yes or No?:>http://www.google.com io=>inputoutput: catch something... st->op1->cond cond(yes)->io->e cond(no)->sub1(right)->op1 ``` -------------------------------- ### Initialize Critic Extension Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/critic.md Import the markdown library and initialize it with the 'pymdownx.critic' extension. ```python import markdown md = markdown.Markdown(extensions=['pymdownx.critic']) ``` -------------------------------- ### Registering and Running a Block Extension Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/blocks/api.md Demonstrates how to instantiate and use a custom block extension with the Python Markdown library. ```python import markdown MD = """ /// my-block content /// """ print(markdown.markdown(MD, extensions=[MyBlockExtension()])) ``` -------------------------------- ### Install PyMdown Extensions with Pip Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/installation.md Use this command to install the latest version of PyMdown Extensions via pip. ```bash $ pip install pymdown-extensions ``` -------------------------------- ### Blockquote Unalignment Example 2 Source: https://github.com/facelessuser/pymdown-extensions/blob/main/tests/extensions/superfences/superfences (failures).txt Another example of a code block within a blockquote showing unaligned content. ```markdown >``` > Test > Will > break ``` -------------------------------- ### Emoji Alt Text Output Example Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/emoji.md Example of direct Unicode output for an emoji using the alt text generator. ```html 😃 ``` -------------------------------- ### Single Letter List Start Assumption Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/fancylists.md A single letter starting a list is assumed alphabetical unless the letter is 'i' or 'I', which are treated as numerical. ```markdown h. Item h i. Item i j. Item j --- i. Item 1 ii. Item 2 iii. Item 3 ``` -------------------------------- ### Install PyMdown Extensions in Editable Mode Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/installation.md Install PyMdown Extensions in editable mode using pip. This is useful for development as changes are reflected immediately without reinstallation. ```bash $ pip install --editable . ``` -------------------------------- ### Initialize Details Extension Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/details.md Include 'pymdownx.details' when initializing the Python Markdown converter to enable the Details extension. ```python import markdown md = markdown.Markdown(extensions=['pymdownx.details']) ``` -------------------------------- ### Strip HTML Comments Example Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/striphtml.md This example demonstrates stripping HTML comments using the StripHTML extension. It shows the input with a comment and an attribute, and the resulting HTML after processing. ```text Here is a test. ``` -------------------------------- ### Initialize MagicLink Extension Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/magiclink.md Import the markdown library and instantiate the Markdown class with the 'pymdownx.magiclink' extension enabled. ```python import markdown md = markdown.Markdown(extensions=['pymdownx.magiclink']) ``` -------------------------------- ### Custom Formatter Function Example Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/superfences.md This custom formatter function generates an HTML div. It uses the 'opt' option passed from the validator and the source content. Attributes are ignored in this example. ```python def custom_format(source, language, class_name, options, md, **kwargs): """Custom format.""" return '
%s
' % (language, class_name, options['opt'], html_escape(source)) ``` -------------------------------- ### Initialize Snippets Extension Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/snippets.md Import the markdown library and initialize it with the 'pymdownx.snippets' extension. ```python import markdown md = markdown.Markdown(extensions=['pymdownx.snippets']) ``` -------------------------------- ### Initialize Definition Blocks Extension Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/blocks/plugins/definition.md Import the markdown library and initialize the Markdown instance with the `pymdownx.blocks.definition` extension. This is necessary if you are customizing meta-plugins. ```python import markdown md = markdown.Markdown(extensions=['pymdownx.blocks.definition']) ``` -------------------------------- ### Emoji SVG Sprite HTML Output Example Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/emoji.md Example HTML output for an emoji using the SVG sprite generator. It includes a class and a use element referencing the sprite. ```html 😄 ``` -------------------------------- ### Initialize Arithmatex Extension Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/arithmatex.md Import the markdown library and include 'pymdownx.arithmatex' in the extensions list to enable the Arithmatex functionality. ```py3 import markdown md = markdown.Markdown(extensions=['pymdownx.arithmatex']) ``` -------------------------------- ### Install Spell Checking Requirements and Aspell Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/about/development.md Install Python dependencies for spell checking and the Aspell spell checker utility on a Linux system. This is a prerequisite for running the spell checker locally. ```bash pip install -r requirements/docs.txt sudo apt-get install aspell aspell-en ``` -------------------------------- ### Basic Callout Syntax Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/quotes.md Demonstrates the basic syntax for creating a callout using a blockquote with a specified type like 'note'. ```text > [!note] > Here is a note ``` -------------------------------- ### HTML with Inline Styles and Event Handlers Source: https://github.com/facelessuser/pymdown-extensions/blob/main/tests/extensions/striphtml/striphtml.txt This example demonstrates nested HTML spans with inline styles and an onclick event handler. The 'unquoted' attribute example shows an attribute value without quotes. ```html link Some text ``` -------------------------------- ### Forcing Lowercase Alphabetic List with Block Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/fancylists.md Uses a special Block to force a lowercase alphabetic list by setting `type=a`. This ensures the first list item is parsed as alphabetical, even if it starts with 'i'. The `start` attribute can be used to ignore the actual value of the first item. ```markdown /// fancylists | type=a i. item i j. item j /// ``` ```markdown /// fancylists | type=a start=9 #. item i #. item j /// ``` -------------------------------- ### Math Environment Rendering with \begin{align*}...\end{align*} Source: https://github.com/facelessuser/pymdown-extensions/blob/main/tests/extensions/arithmatex/arithmatex (dumb dollar).txt Renders multi-line mathematical equations using the \begin{align*}...\end{align*} environment. Use this for aligned equations. ```markdown \begin{align*} x + y & = z \in \left\{ -1, 1 \right\} \\ g + h & = l \end{align*} ``` ```markdown \begin{align*} x + y & = z \in \left\{ -1, 1 \right\} \\ g + h & = l \end{align*} ``` ```markdown \begin{align*}x + y & = z \in \left\{ -1, 1 \right\} \\ g + h & = l \end{align*} ``` ```markdown \begin{align*}x + y & = z \in \left\{ -1, 1 \right\} \\ g + h & = l \end{align*} ``` -------------------------------- ### Initialize Admonition Extension Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/blocks/plugins/admonition.md Import and initialize the Admonition extension for Markdown processing. Ensure the 'admonition' extension is disabled if migrating to avoid conflicts. ```python import markdown md = markdown.Markdown(extensions=['pymdownx.blocks.admonition']) ``` -------------------------------- ### Initialize Python Markdown with B64 Extension Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/b64.md Enable the B64 extension by including 'pymdownx.b64' in the extensions list when creating a Markdown instance. ```python import markdown md = markdown.Markdown(extensions=['pymdownx.b64']) ``` -------------------------------- ### Use Dollar Sign Source: https://github.com/facelessuser/pymdown-extensions/blob/main/tests/extensions/arithmatex/arithmatex (generic).txt Example of using dollar signs for inline math expressions. ```tex $ $3.00 + $5.00 = $8.00 $ ``` -------------------------------- ### Enable Shorthand Syntax Options Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/magiclink.md Enable `repo_url_shorthand` and `social_url_shorthand` in the extension options to activate shorthand syntax. Ensure `provider`, `user`, and `repo` are set for code repository providers to enable full shorthand capabilities. ```markdown --- extensions: - pymdownx.magiclink - pymdownx.saneheaders - markdown.extensions.attr_list extension_configs: pymdownx.magiclink: repo_url_shortener: true repo_url_shorthand: true social_url_shorthand: true social_url_shortener: true user: facelessuser repo: pymdown-extensions --- @facelessuser @x:x ``` -------------------------------- ### Entity Relationship Diagram Example Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extras/mermaid.md Use this for modeling database schemas. Define entities and their relationships. ```diagram erDiagram CUSTOMER ||--o{ ORDER : places ORDER ||--|{ LINE-ITEM : contains CUSTOMER }|..|{ DELIVERY-ADDRESS : uses ``` -------------------------------- ### Import Test Module Source: https://github.com/facelessuser/pymdown-extensions/blob/main/tests/extensions/superfences/superfences (no pygments).html Demonstrates importing a test module. ```python import test ``` -------------------------------- ### Example with nested blocks in HTML wrapper Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/blocks/index.md Presents nested blocks within an HTML wrapper, demonstrating how different fence counts are used to manage nesting levels. ```html ///// html | div.result //// note | Some title /// details | Summary type: warning content /// Content //// ///// ``` -------------------------------- ### Sequence Diagram Example Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extras/mermaid.md Use this for illustrating interactions between participants over time. Define participants and message flows. ```diagram sequenceDiagram participant Alice participant Bob Alice->>John: Hello John, how are you? loop Healthcheck John->>John: Fight against hypochondria end Note right of John: Rational thoughts
prevail! John-->>Alice: Great! John->>Bob: How about you? Bob-->>John: Jolly good! ``` -------------------------------- ### Open Details Block (HTML Wrapper) Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/blocks/plugins/details.md Shows how to set a details block to be open by default when using an HTML wrapper. ```html //// details | Some summary open: True Some content //// ``` -------------------------------- ### Unexpected Blockquote in Code Source: https://github.com/facelessuser/pymdown-extensions/blob/main/tests/extensions/superfences/superfences (failures).txt A code block containing a line that starts with a blockquote marker, which can disrupt parsing. ```markdown Test will > break ``` -------------------------------- ### Get Gemoji Version Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/emoji.md Retrieve the version of the Gemoji index used by the extension. This is useful for compatibility checks. ```python import pymdownx.gemoji_db as gmdb >>> gmdb.version 'v3.0.1' ``` -------------------------------- ### Get EmojiOne Version Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/emoji.md Retrieve the version of the EmojiOne index used by the extension. This is useful for compatibility checks. ```python import pymdownx.emoji1_db as e1db >>> e1db.version 'v2.2.7' ``` -------------------------------- ### B64 Image Processing Example Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/b64.md Shows how B64 processes a standard Markdown image reference and converts it into an HTML tag with the image embedded as a base64 data URI. ```text ![picture](../_assets/bg.png) ``` ```html

picture ``` -------------------------------- ### Configure SuperFences for Custom Math Fences Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/arithmatex.md Configure SuperFences to create custom math fences. `pymdownx.arithmatex` does not need to be included as an extension when using this configuration. ```python import pymdownx.arithmatex as arithmatex extensions = [ "pymdownx.superfences" ] extension_config = { "pymdownx.superfences": { "custom_fences": [ {"name": "math", "class": "arithmatex", "format": arithmatex.arithmatex_fenced_format(mode="generic")} ] } } ``` -------------------------------- ### Invalid Code Block Example Source: https://github.com/facelessuser/pymdown-extensions/blob/main/tests/extensions/superfences/superfences (failures).txt A code block that will not be recognized due to improper formatting or lack of surrounding context. ```markdown This will not work. ``` -------------------------------- ### Build Documentation Assets Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/about/development.md Build the final documentation output, including packaging, minimizing, and revisioning scripts and stylesheets. This command also updates 'zensical.yml' with new file revisions. ```bash npm run build ``` -------------------------------- ### Blockquote Unalignment Example 1 Source: https://github.com/facelessuser/pymdown-extensions/blob/main/tests/extensions/superfences/superfences (failures).txt Demonstrates a code block within a blockquote where content indentation is inconsistent with the blockquote marker. ```markdown >``` > Test Will break ``` -------------------------------- ### Basic Definition Block HTML Output Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/blocks/plugins/definition.md The `/// define` syntax renders as an HTML definition list. This example shows the equivalent HTML output for the basic definition block. ```html //// define Apple - Pomaceous fruit of plants of the genus Malus in the family Rosaceae. //// ``` -------------------------------- ### Python Method Definition Source: https://github.com/facelessuser/pymdown-extensions/blob/main/tests/test_extensions/_snippets/indented.txt Defines a simple Python method within a class. This is a basic example of method definition in Python. ```python class SomeClass: """Docstring.""" # --8<-- [start: py-section] def some_method(self, param): """Docstring.""" return param # --8<-- [end: py-section] ``` -------------------------------- ### Build Documentation for Spell Checking Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/about/development.md Build the project documentation, including cleaning previous builds, in preparation for spell checking. This ensures the spell checker operates on the latest generated content. ```bash python3 -m zensical build-f zensical.yml --clean ``` -------------------------------- ### Basic Details Block Usage Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/blocks/plugins/details.md Demonstrates the basic syntax for creating a collapsible details block with a summary. ```text /// details | Some summary Some content /// ``` -------------------------------- ### Using a Custom Admonition Type Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/blocks/plugins/admonition.md Example of using a custom admonition type ('some-custom-type') that has been registered via extension configuration. ```text /// some-custom-type | Some title Some content /// ``` -------------------------------- ### Initialize FancyLists with SaneHeaders Source: https://github.com/facelessuser/pymdown-extensions/blob/main/docs/src/markdown/extensions/fancylists.md Initialize the Markdown parser with the 'fancylists' and 'saneheaders' extensions. SaneHeaders is required for generic ordered list styles. ```python import markdown # SaneHeaders required for generic ordered styles `#.` and `#)` md = markdown.Markdown(extensions=['pymdownx.fancylists', 'pymdownx.saneheaders']) ```