Markdown include section from another file

289 Views Asked by At

I want to include just a section from another markdown file in our documentation base.

Our documentation is built in DocFx.

I'm able to include the whole file but I just want a section from the file. For example, this works [!include[title](file2.md)]

But it doesn't allow me to embed just a section if I use this [!include[title](file2.md#header2)]

My guess is it isn't supported but wanted to reach out in case someone knew something I didn't.

1

There are 1 best solutions below

0
nrmontagne On

To include a specific section of a markdown file, I would use the xref cross-referencing syntax which supports the use of hashtag. See DocFX documentation here for an example.