Can I use .RenderString with a custom output format?

I’m trying to render a plain text version of my posts, for use with auto-posting to social media via the RSS feed. My first approach was simply to use the plainify function, but this strips too much formatting (i.e. all paragraphs are lost).

What I really want is the ability to convert Markdown to plain text, so that paragraphs and lists, for example, are preserved.

The .RenderString function looks quite promising, except that there’s no (documented) way to specify the output format. Hugo already supports a wide array of output formats, including text/plain, but I guess .RenderString just doesn’t allow this? Or am I overlooking something?

Perhaps a PR to modify .RenderString to accept an output format as one of its optional arguments would be the solution? (I’d be happy to take a stab at it, if that is the way forward).

Perhaps there’s a better way to achieve my goal of creating a plain text representation of a blog post, though.

Thanks for any thoughts.

Have you looked at .RawContent? I think this is about as close as you’re going to get. You can do some regex magic on it to strip out stuff you don’t want.

Thanks. That may be a good step in the right direction.