-
Notifications
You must be signed in to change notification settings - Fork 67
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
Code annotations fail to render with techdocs-core
plugin enabled
#128
Comments
I came to the same conclusion that this issue was being caused by This fixed code annotation rendering on the mkdocs site directly ( mkdocs.yml site_name: test-annotations
theme:
name: material
features:
- content.code.annotate
plugins:
- techdocs-core
hooks:
- hooks.py
markdown_extensions:
- pymdownx.highlight:
anchor_linenums: true
line_spans: __span
pygments_lang_class: true
- pymdownx.inlinehilite
- pymdownx.snippets
- pymdownx.superfences
nav:
- home: index.md hook.py import mkdocs
@mkdocs.plugins.event_priority(-100)
def on_config(config):
config['theme']['palette'] = {}
config['theme']['palette']['scheme'] = 'default'
return config |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
still an issue |
We are also looking to use annotations. Related issue #145 for updates on core packages relevant as well |
Hi, @rmartine-ias. However, two other issues mean the annotations don't display from within Backstage: First, we sanitize the HTML rendered by MkDocs in the TechDoc plugin before we display it on the page. This will remove the script tags that are generated by the plugin for the annotations. Second, even if we modified the sanitization to keep the scripts, the way the rendered DOM is attached to the page still means that the javascript doesn't execute. We use the DomParser to convert the HTML string into DOM elements, and through this, any script tags get marked as unexecutable. Because of this, we'd require quite a drastic change to how the frontend plugin works to enable this, so it's not something we can support currently. |
It's not perfect but I made it work using addon. Most of the code copied from mkdocs material. Code:
|
Something
techdocs-core
is doing (maybe settingtheme.palette
to''
?) prevents code annotations from rendering.Reproduction:
python3.11 -m venv .venv source .venv/bin/activate pip install mkdocs-techdocs-core mkdir docs
mkdocs.yml
:docs/index.md
:Without techdocs:

With it:

I noticed that if I have no plugins set, and set
theme.palette
to""
, then annotations also fail to render. So I think this might be causing it, but don't see an easy fix.The text was updated successfully, but these errors were encountered: