Markdown reference links cannot be used from DFM include files
See original GitHub issueMarkdown reference links cannot be used from DFM include files
Functional impact
This is a markdown reference link: [example]: http://example.com
This is a DFM include statement: [!include[links](../linksinc.md)]
Currently markdown-reference-links must be used from the same md file in which they are defined.
Minimal repro steps
- Create a file “a.md”:
This is an [example], the last word should be a link.
[!include[links](linksinc.md)]
- Create a file “linksinc.md”
This is an [example], the last word should be a link.
[example]: http://example.com
- Include a.md into a docfx project, and build it.
Expected result
Both “[example]” sections should be found an expanded.
Actual result
Only “[example]” sections inside of linksinc.md will be expanded.
Further technical details
It seems the way the markdown engine is built, the included markdown files are being expanded separately, not allowing markdown reference links to be resolved into an include-file.
Maybe the markdown-engine not resolve markdown reference links until !include statements have merged all include files into a single unit. [This would work more like the Standard C preprocessor]
Thank you for creating Docfx, it is a awesome project!.
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (5 by maintainers)
@cameron-elliott If your document has many reference definition, why not use xref? e.g.: your article is:
docfx.json
, add the path of xref map in “xref”, or use command line option-x
A bit related: #8712.