-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Add "block" option/action to markdownify #3040
Comments
You are right, that was a bad idea -- I'm not sure what I was thinking. |
Or, thinking about it -- I'm not sure. The main use case for |
Can we have a parameter for that? Something like |
Not always. |
It's actually a lot harder. Especially when you have non- |
Perhaps |
Here is what we need:
Not sure if the Thoughts? |
Non standards behaviors should die in fire. Hugo is young yet. I think it's still time to deprecate Thank you all for your attention. |
What standard? The |
Yeap. Which is the same as the Markdown Extra and others markdown libs. To remove the Sometimes we need to output just inline markdown, but this case is the exception, not the default. |
No, that is not a standard. The |
is this issue still without solution? I'm using multiline toml syntax to create little blocks of content that needs to be markdownified and I'm encountering issues with the first paragraph not wrapped in I think the main goal of @bep what do you think? is this issue currently being considered or is abandoned? thank you! |
It is not closed, so it's not abandoned. |
To mark som text as one or more blocks. Note that the `block` keyword is reserved in Go templates, hence this plural. See gohugoio#3040
…ocks As in the example below: ``` {{ "Blocks of *text*." | blocks | markdownify}} ``` Fixes gohugoio#3040
To mark som text as one or more blocks. Note that the `block` keyword is reserved in Go templates, hence this plural. See gohugoio#3040
…ocks As in the example below: ``` {{ "Blocks of *text*." | blocks | markdownify}} ``` Fixes gohugoio#3040
This makes things a little difficult -- in the past, one could always wrap the transform (e.g. Now, depending on whether the transformed text has multiple paragraphs, it ends up as |
@noonat , I'm sorry. I don't understand you. What happened this time? |
I am not sure if I understand you correctly @noonat, but @bep posted something similar somewhere else, and I used that in order to always wrap my text in either a single
Just replace |
I hate to necro this issue back from the dead, but the provided solution doesn't work in all cases. For example, if my markdown is
Which is not at all what one would generally expect, and is quite difficult to try to fix. Edit: It also isn't valid HTML since a paragraph element cannot contain a heading element. |
I'm also going to chip in, as it feels like a very odd decision to strip the
Currently: <div class="c-content">
Liquorice cake cake jelly jelly beans. Candy oat cake oat cake oat cake sesame snaps. Croissant cotton candy carrot cake cake brownie wafer chupa chups chocolate.
</div>
<div class="c-content">
<p>Liquorice cake cake jelly jelly beans.</p>
<p>Candy oat cake oat cake oat cake sesame snaps. Croissant cotton candy carrot cake cake brownie wafer chupa chups chocolate.</p>
</div> Expected: <div class="c-content">
<p>Liquorice cake cake jelly jelly beans. Candy oat cake oat cake oat cake sesame snaps. Croissant cotton candy carrot cake cake brownie wafer chupa chups chocolate.</p>
</div>
<div class="c-content">
<p>Liquorice cake cake jelly jelly beans.</p>
<p>Candy oat cake oat cake oat cake sesame snaps. Croissant cotton candy carrot cake cake brownie wafer chupa chups chocolate.</p>
</div> I hope it is something that will reconsider for you to reopen the issue, and implement a fix or add an option to enable the expected behavior 😃 Dropping some links aswell: |
Here's an improved version of @imjasonmiller's code - it will add missing (Copying my solution from the forum, I hope that's OK.)
|
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
As @robsonsobral commented in the original issue #1025 that added this "functionality", this is really non-standard, confusing behaviour. Why was it added in? More importantly, can it be removed, or put behind a config option?
For context, refer to this commit be627fa. Hugo manually strips the leading and trailing paragraph tags, thereby rendering the
markdownify
function useless for any string that contains block level markdown.This can cause major bugs! For example, if your yaml frontmatter looks like this:
markdownify
will output the following, incorrect HTML, where the opening tag for the first paragraph, and closing tag for the last paragraph are missing!The text was updated successfully, but these errors were encountered: