-
Notifications
You must be signed in to change notification settings - Fork 986
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
Reference-style links don't work inside Markdown shortcodes #2710
Comments
By the way, I also don't understand why I need to use the |
Issue 1 (link)Use like this, note, follow line break:
Issue 2(markdown filter)note.md (follow line break):
|
You don't. Why do you use it? |
@harrymkt thanks, that does indeed resolve both issues - the reference-style links work now and I don't need the markdown filter any more. I'm now using this shortcode definition, with the filename being
I investigated a bit more and found out that the issue I was experiencing before is more nuanced. When I change the contents of
Reference-style links and markdown features like italics, backticks being turned into
works as expected, but this content:
Gets rendered as |
Addition to the above comment: if I change the contents of
i.e. use the |
In short, in order for the shortcode to know it passes as markdown, you need to add line break before and after it.
For readability I think you should use div tag because the content itself will have many paragraph tags.
HTH! |
That is super unexpected, though. Would it be difficult to fix that? If not, it should at least be in the docs - well, Markdown shortcodes should be in the docs in general 😅 I might be able to find the time to add a doc PR if that would be welcome?
It actually looks the same in the end, but you're right, wrapping it in an extra |
I don't think it would be difficult. However, it is not unusual to put blank line break before and after it which makes the markdown parser clear, in fact this is done only 1 time in the shortcode so I don't think it'd be a problem after all. I previously used Hugo and I think that extra is not required, I don't exactly remember though. Of course, Zola's documentation isn't mentioned. Another thing is that Zola will likely decline the feature request if that is not necessary because not to make it complicated like Hugo, but I don't know if the one you're talking about is possible the contributors might implement it, in which case they would participate in this discussion.
Of course yeah, they would welcome all contributions.
Of course if you don't add the div tag the content will end up inside another paragraph, which is, as the documentation suggests. |
Looking at your examples, it seems you don't actually want markdown shortcodes? You're wrapping the body in HTML which means the commonmark parser is going to view the whole thing as HTML and not process anything in there. |
Well, I'm looking for a way to have markdown styling and reference-style links work in shortcodes. I don't really care which type of shortcode I use for that. I got the styling to work in HTML shortcodes (using the
But the Markdown content I put inside the shortcode in my content does get rendered? At least if I have the line breaks around |
Bug Report
Environment
Zola version: v0.19.2
Expected Behavior
Reference-style links inside Markdown shortcodes using references defined outside of the shortcode generate an HTML link with the correct target.
Current Behavior
Reference-style links inside Markdown shortcodes using references defined outside of the shortcode generate output like this: [link text][target].
Step to reproduce
Create a shortcode
note.md
with the following content:and use it in
content/page.md
like this:The text was updated successfully, but these errors were encountered: