Replacement for mmark include file functionality

With mmark now deprecated, I need to replace the include file functionality it gave me ( I use it a lot!). I’ve checked through the goldmark repo and can’t find anything obvious that replaces it. Is it supported natively in CommonMark?


I think your best bet is to create a include shortcode. But remember to use {{% when using it so the content gets inlined.

1 Like

Thanks @bep :+1:

So my include shortcode works fine for all pages except ones where I have a tabs/tab shortcodes in my mmark pages. This is an example structure of the new include shortcode:

{{% include "./static/include/" %}}

And the shortcode HTML file is structured:

{{ $file := .Get 0 }} {{ if strings.HasSuffix $file ".md" }} {{ $file | readFile | safeHTML }} {{ end }}

The existing pages with tabs shortcode (for example is as follows (note old style include file format):

{{% tabs %}}
{{% tab "Cloud" %}}

When replacing the existing include file shortcode via mmark with the new shortcode version breaks everything, and I’m not sure what is going wrong. Any pointers?


@marksouthee thanks for posting your code - most helpful. This is the way to go for folks who are looking to use mmark type include file functionality but don’t want to use something that’s headed for deprecation.