Skip to content
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

markdownextradata-plugin variables don't get resolved in Snippets #1952

Closed
Stwissel opened this issue Feb 18, 2023 · 2 comments
Closed

markdownextradata-plugin variables don't get resolved in Snippets #1952

Stwissel opened this issue Feb 18, 2023 · 2 comments
Labels
S: rejected The pull request is rejected for the stated reasons. S: triage Issue needs triage. T: bug Bug.

Comments

@Stwissel
Copy link

Stwissel commented Feb 18, 2023

Description

When using Snippets embedded variables {{ somename }} from the mkdocs-markdownextradata-plugin don't get resolved. Calling the snippet page directly shows resolution. This is cross-posted from here.

Love your work!

Minimal Reproduction

I'm using your nice plugin together with the pymdownx.snippets plugin

I have

extra:
  test: 1.0.0
plugins:
  - search
  - awesome-pages
  - section-index
  - tags
  - markdownextradata
markdown_extensions:
  - admonition
  - pymdownx.details
  - pymdownx.superfences
  - attr_list
  - pymdownx.tabbed:
      alternate_style: true
  - pymdownx.emoji:
      emoji_index: !!python/name:materialx.emoji.twemoji
      emoji_generator: !!python/name:materialx.emoji.to_svg
  - pymdownx.snippets:
      base_path:
        - "docs/snippets"

and a test.md

# Test of extras

This is top: {{test}}

--8<-- "snippet.md"

End

and a snippet.md

In the snippet: {{test}}

Expected outcome

<h1>Test of extras</h1>

This is top: 1.0.0
In the snippet: 1.0.0

End

Actual outcome

<h1>Test of extras</h1>

This is top: 1.0.0
In the snippet: {{test}}

End

What do I miss?

Version(s) & System Info

  • Operating System: Linux container, Kernel 5.15.78-0-virt, Alpine Linux v3.15
  • Python Version: 3.11.0
  • Package Version: 9.9
@Stwissel Stwissel added the T: bug Bug. label Feb 18, 2023
@gir-bot gir-bot added the S: triage Issue needs triage. label Feb 18, 2023
@facelessuser facelessuser added the S: rejected The pull request is rejected for the stated reasons. label Feb 18, 2023
@facelessuser
Copy link
Owner

Snippets is a Python Markdown plugin, it has no knowledge of MkDocs plugins and cannot promise any compatibility with a MkDocs plugins. If you need variable replacements, you would either need a Python Markdown plugin that replaces variables after Snippets resolves the snippets, or use a MkDocs plugin that injects snippets before variables are resolved. Right now you are trying to get two different plugins that are operating under completely different contexts and neither has knowledge of the other, and they are not going to play well together. There is nothing I can do to change this behavior.

@Stwissel
Copy link
Author

Thx for the clarification. Just navigating the triangle. Btw... love your work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S: rejected The pull request is rejected for the stated reasons. S: triage Issue needs triage. T: bug Bug.
Projects
None yet
Development

No branches or pull requests

3 participants