How to add admonitions to an ordered list? #3763
-
Adding admonitions to ordered list doesn't render properly if its indented under the the list item. Removing the indentation makes it render properly but it breaks the ordered list sequencing. I am trying to do something like this.
|
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 7 replies
-
List item content must be indented by four spaces:
|
Beta Was this translation helpful? Give feedback.
-
I am encountering the same issue. No amount of indenting allows me to show the admonition when it's inside a list. It renders as plain text. My source: 1. List item
!!! info
Help. Versions from mkdocs==1.2.4
mkdocs-material==8.1.11
mkdocs-material-extensions==1.0.3
mkdocs-git-revision-date-plugin==0.3.1
mkdocs-autolinks-plugin==0.5.0
mkdocs-redirects==1.0.4
mdx-truly-sane-lists==1.2
jinja2==3.1 Relevant portion of theme:
name: material
custom_dir: docs/assets/overrides
palette:
scheme: default
logo: assets/logo.png
favicon: assets/favicon.png
features:
- navigation.tabs # Top-level pages are shown as tabs on the header
- navigation.tabs.sticky # Navigation tabs are always visible
- navigation.top # "Back to top" button appears upon upward scrolling
- navigation.indexes # Allow section headers to have a page (see tech/index.md)
markdown_extensions:
- admonition # Info boxes (in different colors)
- pymdownx.details # "
- pymdownx.superfences # Info boxes, tabs
- pymdownx.caret # Allow superscript and insertion marks (^ and ^^)
- pymdownx.tilde # Allow subscript and deletion marks (~ and ~~)
- pymdownx.keys # Allow Keyboard marks (++)
- pymdownx.mark # Allow selection marks (==)
- pymdownx.inlinehilite # Syntax-highlight inline code
- pymdownx.tabbed: # Tabbed content
alternate_style: true
- toc: # TOC control
permalink: 🖈 # Add permalinks to headers
- pymdownx.arithmatex: # Math blocks
generic: true
- mdx_truly_sane_lists # 2-space indented nested lists
- attr_list # { Annotations }
- md_in_html # Markdown inside HTML
- def_list # Definition lists (Glossary)
plugins:
- search # Search box at the top
- git-revision-date # Last edit timestamp at the bottom
- autolinks # Use just filenames instead of full or relative paths |
Beta Was this translation helpful? Give feedback.
-
It figures, the moment I post the issue I find the culprit. The The suggested solution worked for me: use 2-space indents which is what |
Beta Was this translation helpful? Give feedback.
-
🏅 thx ... am in the same boat with the TechDocs. |
Beta Was this translation helpful? Give feedback.
-
2-space indents isn't working for me. Can you provide a working snippet? It's a fairly terrible solution, but you can do it with inline HTML: 1. Some List Item
<!-- We use an HTML element because admonitions are not parsed if indented,
and if it is unindented, it breaks list parsing (1, 1, 2...) and adds a
margin to all following list items. -->
<!-- markdownlint-disable MD033 -->
<div class="admonition tip inline end">
<p class="admonition-title">Tip</p>
If Docker is not enabled, use <code>--no-docker</code> instead of
<code>--docker-image</code>, and ensure the <code>venv</code> is activated.
</div>
<!-- markdownlint-enable MD033 --> |
Beta Was this translation helpful? Give feedback.
It figures, the moment I post the issue I find the culprit. The
mdx_truly_sane_lists
extension is interfering, and it's a known issue:radude/mdx_truly_sane_lists#6
The suggested solution worked for me: use 2-space indents which is what
mdx_truly_sane_lists
sets as default.(Incidentally, this renders my statement "No amount of indenting allows me to show the admonition when it's inside a list" utterly false. Apologies.)