Confusing [include <…>] in MD files

Hello,

I was recently looking into how MLIR documentation is generated, and found that in the llvm-project/mlir repo, a lot of the markdown files have a strange include tag, for example;
In mlir/docs/Dialects/Affine.md after the ‘Operations’ header there’s the line
[include "Dialects/AffineOps.md"], and on the affine docs page, AffineOps.md seems to be injected in.

I’ve been trying to find out how this works as I’d like to do something similar for the Fortran IR documentation, yet I can’t seem to find exactly where this is dealt with.

Could anyone give some insight or point me towards where it happens?

I’m assuming you mean how these are processed fo produce “regular” markdown? Markdown is a lot less standardized than I thought when we started, and in particular we were using a variant that had an include directives while the Hugo renderer used didn’t. But Hugo allows for something they call short codes which enabled adding them https://github.com/llvm/mlir-www/commit/69030dfe1716f24a9ea2f197f8dfffbbbe52d310 and then we just had to add a small conversion between the directive that some markdown renderers support and the shortcode https://github.com/llvm/mlir-www/blob/main/process_included_docs.sh

Ah perfect, that makes sense.

Thank you very much! :smiley: