squidfunk / mkdocs-material

Documentation that simply works
https://squidfunk.github.io/mkdocs-material/
MIT License
19.27k stars 3.4k forks source link

Annotation doesn't work inside markdown tables #7195

Closed adhadse closed 1 month ago

adhadse commented 1 month ago

Context

I'm trying with latest mkdoks-material (9.5.23) and following the reference for adding annotation. I know annotation doesn't work inside katex, so I tried adding it outside, and since tables also can't add the annotation with { .annotate } I tried wrapping the table inside inside a <div class="annotate">. image

Bug description

I tried something like this:

<div class="annotate" markdown>
| $P$                                 | $Q$                                 | $P \implies Q$                         |
| ----------------------------------- | ----------------------------------- | -------------------------------------- |
| $\textcolor{#f56c42}{\text{false}}$ | $\textcolor{#f56c42}{\text{false}}$ | $\textcolor{#07fc03}{\text{true}}$ (1) |  
| $\textcolor{#f56c42}{\text{false}}$ | $\textcolor{#07fc03}{\text{true}}$  | $\textcolor{#07fc03}{\text{true}}$ (2) |
| $\textcolor{#07fc03}{\text{true}}$  | $\textcolor{#f56c42}{\text{false}}$ | $\textcolor{#f56c42}{\text{false}}$    |
| $\textcolor{#07fc03}{\text{true}}$  | $\textcolor{#07fc03}{\text{true}}$  | $\textcolor{#07fc03}{\text{true}}$     |
</div>

1. The formula doesn't state when $P$ is _not true_, it's assumed maybe the robot has antenna, maybe it doesn't.
2. The formula doesn't state when $P$ is _not true_, it's assumed maybe the robot has antenna, maybe it doesn't.

This does produce the annotation button, but upon clicking it doesn't show the annotation text.

Related links

Reproduction

9.5.23-annotation-inside-table-does-not-appear.zip

Steps to reproduce

  1. The above zip file includes all the required things to reproduce the above bug.
  2. Install mkdocs-material 9.5.23
  3. Set mkdocs.yaml as :
site_name: My Docs

theme:
  name: material

markdown_extensions:
  - pymdownx.highlight:
      anchor_linenums: true
      line_spans: __span
      pygments_lang_class: true
  - pymdownx.inlinehilite
  - pymdownx.snippets
  - pymdownx.superfences
  - pymdownx.mark
  - pymdownx.details
  - admonition
  - footnotes
  - attr_list
  - tables
  - md_in_html

plugins:
  - info
  1. add table content as:
| hello | world| | --- | --- | | i | text (1)|
  1. a text should be shown test 1

Browser

Edge

Before submitting

squidfunk commented 1 month ago

Thanks for reporting. This is a known limitation, as stated in our documentation:

Bildschirm­foto 2024-05-20 um 12 39 25

In addition, footnote tooltips are a superior approach to annotations, as they are native Markdown and don't rely on client-side parsing, which is why we recommend them over annotations. However, you'll need to sponsor to use this feature.

squidfunk commented 1 month ago

Closing as duplicate of #3453.