Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to pymdownx's new Blocks API #609

Open
4 tasks
felker opened this issue Jan 13, 2025 · 0 comments
Open
4 tasks

Upgrade to pymdownx's new Blocks API #609

felker opened this issue Jan 13, 2025 · 0 comments

Comments

@felker
Copy link
Member

felker commented Jan 13, 2025

Mentioned in #601 (comment)

pymdownx introduced a new Blocks API as experimental in v9.10 (2023-03-05) and moved it out of beta in 10.12 (2024-10-28)
, while marking some of the older API's extensions (Details, Tabbed) as "legacy". There are a handful of advantages to the new API, but the chief benefits are that 1) it is more extendable, and 2) whitespace indentation is no longer necessary when writing them, especially helpful for nested blocks.

The first step would be to modify mkdocs.yml, i.e.

user-guides/mkdocs.yml

Lines 322 to 351 in 03b4d6c

markdown_extensions:
- footnotes
- admonition
- codehilite
- tables
- attr_list
- md_in_html
- def_list
- pymdownx.critic
- pymdownx.inlinehilite
- pymdownx.keys
- pymdownx.caret
- pymdownx.mark
- pymdownx.tilde
- pymdownx.snippets:
base_path: ["."] # for root of repo, default since that is where mkdocs.yml is
# base_path: ["docs"]
dedent_subsections: True # experimental; new in 9.10 (2023-03-05)
check_paths: True
url_download: True
- pymdownx.superfences
- pymdownx.details
- pymdownx.inlinehilite
- pymdownx.highlight:
use_pygments: true
anchor_linenums: true
- pymdownx.tabbed:
alternate_style: true
- pymdownx.tasklist:
custom_checkbox: true

would be changed to

 markdown_extensions: 
   - footnotes 
   - codehilite 
   - tables 
   - attr_list 
   - md_in_html 
   - def_list 
   - pymdownx.critic 
   - pymdownx.inlinehilite 
   - pymdownx.keys 
   - pymdownx.caret 
   - pymdownx.mark 
   - pymdownx.tilde 
   - pymdownx.snippets: 
       base_path: ["."]  # for root of repo, default since that is where mkdocs.yml is 
       # base_path: ["docs"] 
       dedent_subsections: True  # experimental; new in 9.10 (2023-03-05) 
       check_paths: True 
       url_download: True 
   - pymdownx.superfences 
   - pymdownx.inlinehilite 
   - pymdownx.highlight: 
       use_pygments: true 
       anchor_linenums: true 
   - pymdownx.tasklist: 
       custom_checkbox: true 
   - pymdownx.blocks
   #- pymdownx.blocks.admonition
   #- pymdownx.blocks.caption
   #- pymdownx.blocks.definition
   #- pymdownx.blocks.details
   #- pymdownx.blocks.html
   - pymdownx.blocks.tab
       alternate_style: true 
  • Change mkdown.yml extensions as above
  • Perform bulk replacement of !!! Admonitions and ??? Details fence syntax with ///
  • Double check that this new pymdownx API remains fully compatible with mkdocs-material
  • Try new / create ALCF-customized extension functionality enabled under the new API
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant