-
Notifications
You must be signed in to change notification settings - Fork 867
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Markdown reference links cannot be used from DFM include files #1099
Comments
It is by designed. |
I cannot shy away from offering an honest opinion on this. I think this is a mistake. When you have 10+ complicated links:
I REALLY REALLY REALLY want to use an include file to maintain and include the links rather than copying the links into each markdown file! If I must copy the above blocks into every markdown file, the project becomes very very very hard to maintain and update. Because of your design decision, an article cannot use markdown-reference-links from included files. Because of the current design I must copy those links above into dozens [maybe hundreds] of markdown articles!! I think it is a mistake. I still love DocFx, and think your team has created something awesome! |
Because of your design decision, I will probably be forced to use an external pre-processor to maintain markdown-reference-links, and have them copied into .MD files before running DocFx for a build. I still love DocFx, and think your team has created something awesome! |
@Cameron-elliott the reason is: *a* Then we think wherever you include this file will get a. If some article use the include file like this: *[!include[](inc.md)]* And we pass the context from article, we will get a. *x[!include[](inc.md)] We will get xa*. |
That is not a good argument. The undesirable behavior you describe is exactly how every other "include file" feature works in every other language! Almost every other language that includes the concept of an include file, We could compare the two concepts:
DocFx is unusual, in that defined elements in included-files [children] are not propagated to the including-file. No other language works this way. But, do not listen to my opinion, please go ask senior developers at MSFT-China their opinion, Do not be surprised if they do not understand, and ask "why else would you design an include file system?" Thank you for creating DocFx, and for reading my comments. I hope we can form a productive effort to move DocFx forward. |
By now our design is: include result html, not include source md. |
@Cameron-elliott If your document has many reference definition, why not use xref? Content is: [Intel Quick Sync Video][Intel_Quick_Sync_Video] and [Intel HD and Iris Graphics][Intel_HD_and_Iris_Graphics]
[Intel_Quick_Sync_Video]: https://en.wikipedia.org/wiki/Intel_Quick_Sync_Video
[Intel_HD_and_Iris_Graphics]: https://en.wikipedia.org/wiki/Intel_HD_and_Iris_Graphics
|
Unlike When designing DFM, we hope DFM is easy to use and result predictable. The best case is that the result is quite similar to what markdown editors(like Github) preview shows. So when we introduce |
Okay, very good points everybody. |
A bit related: #8712. |
Markdown 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
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!.
The text was updated successfully, but these errors were encountered: