fix: shortcode in inline elements #2601
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes Issue: #2565
BTS
Step 1: Minimum reproducible example (to break shortcodes)
Step 2: Investigating code which references
@@ZOLA_SC_PLACEHOLDER@@
Step 3: Investigating
shortcode.render
call inmarkdown.rs
shortcode.render
was invoked for each shortcode@@ZOLA_SC_PLACEHOLDER@@
,shortcode.render
was NOT invokedhtml_shortcodes
list (which had the shortcode references even if they were not rendered)Step 4: Investigating missing shortcodes
!$range.contains(&shortcode.span.start)
skips shortcodes which are not in the rangerange
andshortcode.span
iterator(event, range)
where range -> range in the markdown sourceStep 5: Investigating ranges
Step 6: Adding a test for the issue
can_use_shortcodes_in_inline_elements
incomponents/markdown/tests/shortcodes.rs
Step 7: Fixing the issue by accounting for InlineHtml