Export to markdown with shortcodes

I am trying to parse a markdown and export it as markdown with the shortcode rendered. Is this possible with Hugo. I have tried .RawContent, markdownify, .Content, .Plain etc.

That’s not a lot of information to go off of so it’s kinda hard to say.

Do you have a link to a repo where we can peak at the code for the hugo project?

1 Like

Given a content file at content/post/foo.md, do you need to render a markdown file only, or an HTML file and a markdown file?

Yes. I need to render both HTML and Markdown. I have the HTML and markdown rendering, but no matter what I do, the markdown file contains HTML. I can make a dummy example and post it to github.

I cannot come up with a clean way to accomplish this, and the ugly way is very ugly.

If #7297 were implemented, you could do this in layouts/_default/single.md:

{{ .RawContent | .RenderShortcodes }}

Another approach would require the .RenderString method to accept “HTML” as a markup parameter, but this currently throws an error:

{{ .RawContent | .RenderString (dict "markup" "HTML") }}