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

Jinja2 / Mustache syntax incompatibility #513

Open
Tracked by #515
wojciechczerniak opened this issue Jun 12, 2021 · 3 comments
Open
Tracked by #515

Jinja2 / Mustache syntax incompatibility #513

wojciechczerniak opened this issue Jun 12, 2021 · 3 comments

Comments

@wojciechczerniak
Copy link

Markdown publisher generates attr_list without space after first curly bracket

ie. {#SRS-001 } instead { #SRS-001 }

This may create a problem when we want to render the output markdown documents in any system that uses those markup extensions ie. some documentation engines that are using markdown as content. They recognize {# as a starting block for various block types.

I think that here:

def _format_md_attr_list(item, linkify):
"""Create a Markdown attribute list for a heading."""
return " {{#{u} }}".format(u=item.uid) if linkify else ''

a very small change will solve the issue:

-return " {{#{u} }}".format(u=item.uid) if linkify else ''
+return " {{ #{u} }}".format(u=item.uid) if linkify else ''
@wojciechczerniak
Copy link
Author

⚠️ I found an issue #469 that suggest removing the spaces instead adding them. Should be examined carefully

@neerdoc
Copy link
Collaborator

neerdoc commented Mar 9, 2022

I believe that the default functionality should be as in #469, i.e., no spaces. This is since Jinja2/Mustache syntax are markdown extensions.

If this is a requested feature (to use specific markdown extensions), it should be added as a flag, e.g., --mustache-compatible or similar.

@wojciechczerniak
Copy link
Author

I second that that there should be no spaces as default. But instead introducing flags I would focus on #515 to allow the necessary customizations for even more extensions than we can think off. I didn't close this issue after creating #515 because I see it as a good use case for templating engine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants