[EDIT] Hugo v0.146.3
Context: I wrote an “extract” partial, which works similar to a summary except it uses two
<!--extract-->
dividers (and falls back to.Summary
if it does not find them). This works (it properly extract the content between the dividers), but in the course of testing it, I noticed that sometimes the full.Content
was missing the extract, and this led me to test dividers without even using my partial.
Hello,
I think I’ve come across a weird bug with dividers (e.g. annotations of the form !<--something-->
).
The following markdown content showcases this bug:
Test 1 begin
Lines with <!--starting-->a pair of tags<!--ending--> in the middle are rendered OK.
Test 1 end
Test 2 begin
<!--starting-->Lines with a tag at the beginning and another in the middle<!--ending--> are rendered EMPTY.
Test 2 end
Test 3 begin
Lines with <!--starting-->a tag in the middle and another at the end are rendered OK.<!--ending-->
Test 3 end
Test 4 begin
<!--starting-->Lines with a pair of tags at the beginning and end are rendered EMPTY.<!--ending-->
Test 4 end
Test 5 begin
<!--starting-->Lines with a single tag at the beginning are rendered EMPTY.
Test 5 end
This content is rendered as:
Test 1 begin Lines with a pair of tags in the middle are rendered OK. Test 1 end
Test 2 begin
Test 2 end
Test 3 begin Lines with a tag in the middle and another at the end are rendered OK. Test 3 end
Test 4 begin
Test 4 end
Test 5 begin
Test 5 end
End of tests
When the line does not start with a divider, then the dividers are correctly removed before rendering, and the result is correctly integrated into the paragraph beginning with “Test N begin” and ending with “Test N end”.
But when the line starts with a divider, it is as though the whole line is considered empty for rendering purposes, which causes the preceding “Test N begin” to be considered an isolated paragraph, and the following “Test N end” as well.
I haven’t found anything in the documentation that forbids dividers within a line, and indeed, as the tests above show, the current hugo code partially supports dividers within a line.
I would therefore tend to consider it a bug that a divider at the start of a line eats up said line, and I would start working on proposing a fix, but before that I’d appreciate if an active hugo dev could confirm that it is indeed a bug.
Regards,
Albert.