HUGO

Shortcode to import partial markdown table from file

I try to to build a shortcode that provides the first part of a markdown table from a file and in the .Inner part additional rows can be provided.
The import part was easy, but i’m not able to get the .Inner part rendered as part of the table.

{{ (.Site.GetPage "filename.md").Content }}{{ .Inner }}

If I use .RawContent instead, it does work but then shortcodes used in table cells from the import are escaped/not rendered as markdown.

No. That will not work .Inner is only available within the context of a shortcode.

.Content stands for the rendered content.
.RawContent stands for the unprocessed.

Perhaps would need to have a look at splitting the rendered content to get those table values.

Have a look at this topic the use case is different but the logic may be useful in your case.

OR

Rethink the architecture of the project and store those values elsewhere, so that you can share them between pages more easily, like for example in the dataDir.