Apply `markdownify` to the following content
```markdown
{{</*/* other-shortcode */*/>}}
Some content.
{{</*/* /other-shortcode */*/>}}
```
will reproduce the following result:
{{< markdown >}}
{{</*/* other-shortcode */*/>}}
Some content.
{{</*/* /other-shortcode */*/>}}
{{< /markdown >}}
Here, I used /*/* as the first one will be swallowed when passed to the shortcode.
In the above picture, we see the content of .Inner is
{{</* other-shortcode */>}}
Some content`.
{{</* /other-shortcode */>}}
Markdownify did not remove the comment character. It recognizes the second star as an emphasis.
I’m wondering why this happened. Could someone give some hints or some workaround?
I expected it should trim the comment symbol /* and */, and then call the other-shortcode.
Thank you for providing the information. The addition of a blank line does prevent the asterisk from being interpreted as an emphasis tag. However, I’ve observed that the symbols /* and */ are not being stripped, and several <p> tags are being added.
I have a few questions regarding how Hugo processes a standard Markdown file and the functioning of the markdownify feature:
It appears that markdownify calls shortcodes. Could you clarify why it doesn’t strip the comment symbols?
At what point does markdownify remove comments?
When are shortcodes applied in the processing pipeline?
Could you explain the sequence of operations for a typical Markdown file in Hugo? Is it initially converted to HTML, then subjected to shortcode application, and finally, the layout is applied?
I appreciate your time in addressing these questions. Thank you once again.
Apologies for any confusion earlier. I aim to create a shortcut that displays both the source code and the rendered result side by side. I expect that by inputting a string into markdownify, I can obtain results identical to what is written in the markdown file.
For instance, if the markdown file contains content with comments like this:
{{</* highlight python */>}}
import os
{{</* /highlight */>}}
The desired rendered result should be a string without the comment symbols, resembling this:
{{< highlight python >}} import os {{< /highlight >}}
Is it possible to achieve this using markdownify or other functions provided by Hugo within the shortcode?
These are not comments. The /* and */ strings within the opening and closing shortcode tags are a mechanism for escaping shortcodes to prevent template execution.
What is the “other-shortcode”? Please be precise and provide an example.
Take this for a spin:
git clone --single-branch -b hugo-forum-topic-47329 https://github.com/jmooring/hugo-testing hugo-forum-topic-47329
cd hugo-forum-topic-47329
hugo server
Brilliant to provide the example and host it on GitHub. Based on your example, I made a slight modification to the markdown shortcut in my repository and added example 4 with my expected outcome. Could you please take a look?