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

fix: shortcode in inline elements #2601

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/markdown/src/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ pub fn markdown_to_html(
event
});
}
Event::Html(text) => {
Event::Html(text) | Event::InlineHtml(text) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sadly it's not that easy. There is #2581 which solves both (I did miss it solved the shortcode issue sorry :() but I still don't know whether the continue reading in inline html makes sense.
To keep the fix simple, it should probably be a separate branch that doesn't contain the continue reading stuff and we can decide later if we want the full #2581

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're more the welcome to copy my code and remove the continue-reading bit, FWIW. (Aimed at both amtanq/Keats if either of you want to do it first.)

Otherwise, I'll get around to it at some point.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you have more context on it, would appreciate if you can pick this whenever you get time. LMK if you're okay with it, else would be happy to continue myself too!

if !has_summary && MORE_DIVIDER_RE.is_match(&text) {
has_summary = true;
events.push(Event::Html(CONTINUE_READING.into()));
Expand Down
7 changes: 7 additions & 0 deletions components/markdown/tests/shortcodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,3 +311,10 @@ fn can_use_shortcodes_in_quotes() {
.body;
insta::assert_snapshot!(body);
}

// https://github.com/getzola/zola/issues/2565
#[test]
fn can_use_shortcodes_in_inline_elements() {
let body = common::render(r#"<a href="{{ out_put_id(id="top") }}">top</a>"#).unwrap().body;
insta::assert_snapshot!(body);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
source: components/markdown/tests/shortcodes.rs
assertion_line: 321
expression: body
---
<p><a href="top">top</a></p>