Description
I want to apply an #id to mermaid diagrams via attr_list so that I can link to them.
For example:
```mermaid {#fig:flowchart .myclass}
flowchart LR
A[Hard edge] -->|Link text| B(Round edge)
B --> C{Decision}
C -->|One| D[Result one]
C -->|Two| E[Result two]
```
See the [diagram](#fig:flowchart) above...
Result:
The #fig:flowchart does not appear anywhere in DOM and I can not link to the diagram.
In resulting HTML the diagram is wrapped in:
<div class="mermaid">
...
</div>
but no custom attributes (id and class) are applied to the <div>.
I know I can wrap the code block in <div> but as I'm further processing the input with pandoc + crossref to LaTeX, I would have to apply the attributes for the code block as well and it is cumbersome to keep them in sync.
Tried with both MkDocs and Zensical, both give the same result.
Is it possible to apply the attributes as above and I'm doing something wrong or is this the expected result?
Minimal Reproduction
The relevant section from mkdocs.yml:
markdown_extensions:
- attr_list
- pymdownx.superfences:
custom_fences:
- name: mermaid
class: mermaid
format: !!python/name:pymdownx.superfences.fence_code_format
Additionally:
When I change the fence_code_format to fence_div_format, the custom attributes are applied to the <div> but obviously the diagram is not rendered as image.
Version(s) & System Info
- Operating System: ...
- Python Version: ...
- Package Version: ...
Description
I want to apply an
#idto mermaid diagrams viaattr_listso that I can link to them.For example:
Result:
The
#fig:flowchartdoes not appear anywhere in DOM and I can not link to the diagram.In resulting HTML the diagram is wrapped in:
but no custom attributes (
idandclass) are applied to the<div>.I know I can wrap the code block in
<div>but as I'm further processing the input with pandoc + crossref to LaTeX, I would have to apply the attributes for the code block as well and it is cumbersome to keep them in sync.Tried with both MkDocs and Zensical, both give the same result.
Is it possible to apply the attributes as above and I'm doing something wrong or is this the expected result?
Minimal Reproduction
The relevant section from
mkdocs.yml:Additionally:
When I change the
fence_code_formattofence_div_format, the custom attributes are applied to the<div>but obviously the diagram is not rendered as image.Version(s) & System Info