-
|
Hello, I've developed a custom theme that extends Material for MkDocs for reusing my configurations on several sites. Live actual example of documentation: https://joapuiib.github.io/daw-ed/programacio/dam1s/programacio/ Web site view:
Print page view:
I've created a minimal example with this cutomization available in joapuiib/print-header-custom-template
With this configuration, annotations don't render correctly if placed directly as content.
However, the work nicely inside code blocks.
After investigating a bit, I've found that annotations do some calculations in order to position them properly if inside a table. Related links and issues:
I'm kind of lost with this and I don't know how to solve this. Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
I found a fix for annotations not rendering correctly when placed directly as content (outside code blocks) inside a print layout Root causeThe annotation system positions tooltips using two mechanisms that must agree on the same reference element:
When the page content is wrapped in a
Since the offsets are computed relative to the
FixAdd .md-document__main {
position: relative;
} |
Beta Was this translation helpful? Give feedback.




I found a fix for annotations not rendering correctly when placed directly as content (outside code blocks) inside a print layout
<table>.Root cause
The annotation system positions tooltips using two mechanisms that must agree on the same reference element:
JavaScript uses
offsetLeft/offsetTop, which are relative to the element'soffsetParent. The browser'soffsetParentalgorithm walks up the DOM and stops at the first element that is either a positioned element (position: relative/absolute/fixed/sticky) or a<td>,<th>, or<table>HTML element — regardless of their CSSdisplayvalue.CSS positions
.md-tooltipwithposition: absolute, which is relative to the nearest ancestor withpo…