commonmark-spec icon indicating copy to clipboard operation
commonmark-spec copied to clipboard

Include file

Open ghost opened this issue 6 years ago • 2 comments

If I wish to include a file, it is possible with reStructuredText:

.. include:: app.php

https://docutils.sourceforge.io/docs/ref/rst/directives.html#include

and AsciiDoc:

include::app.php[]

https://asciidoctor.org/docs/asciidoc-syntax-quick-reference#include-files

and Org Mode:

#+INCLUDE: "app.php"

https://orgmode.org/manual/Include-files.html

I think it should be possible to do this with MarkDown.

ghost avatar Dec 29 '19 22:12 ghost

This is a major feature I would want support for in markdown, but I also believe it should be possible to limit what is included. My initial thought would be that a heading can be referenced if only a section of the file is desired.

thomasfinstad avatar Aug 19 '24 11:08 thomasfinstad

Use the image syntax then post-process it by detecting the file extension. You can then call it as “embed” syntax instead of “image” syntax in your Markdown-flavored parser:

![asdf](./includes/app.php)

taufik-nurrohman avatar Aug 19 '24 11:08 taufik-nurrohman