Skip to content
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

support file transclusion (including contents of a file) #9

Closed
timotheecour opened this issue Oct 24, 2018 · 2 comments
Closed

support file transclusion (including contents of a file) #9

timotheecour opened this issue Oct 24, 2018 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@timotheecour
Copy link

timotheecour commented Oct 24, 2018

basically this feature request: github/markup#346

use cases

  • including a csv file (rendering it as a table)
  • including another markdown (cf rst's include)
  • including a LICENSE.txt
  • DRY docs: allows including a version number for example
  • makes it easier to transform Nim's rst files (which have a few include) to markdown
  • embed video

syntax

as proposed here: https://talk.commonmark.org/t/transclusion-or-including-sub-documents-for-reuse/270/3

{{ my_file }} -> include the file and parse it as markdown
{{ my_file[start:end] }} -> include the lines comprised between start and end and parse them as markdown.

there are alternatives that have been proposed in various markdown flavor.

Ideally, it should allow optionally specifying the file type (overriding guessing it from file extension if needed), eg: jpg, csv, md, txt, codebock(?)

caveats

  • github doesn't seem to support this feature
    Github doesn't provide this feature even for reStructuredText (rst) which has include directive in the official language spec : README.rst :include: directive doesn't work github/markup#172

  • I'e seen somewhere github doesn't support it because of security concerns, however I'd like to understand more that concern ; it doesn't seem relevant as far as nim-markdown is concerned

  • different flavors of markdown use a different syntax for this feature

  • other syntax I've seen:

[![Watch the video](https://raw.github.com/GabLeRoux/WebMole/master/ressources/WebMole_Youtube_Video.png)](http://youtu.be/vt5fpE0bzSY)
#include "another-markdown-file.md"

links

CSV files are embedded as tables, source code files become code blocks, and embedded text files help writers structure their work:

@soasme
Copy link
Owner

soasme commented Oct 24, 2018

Nice compiled information. Thanks!

I think we can implement it but turn it off by default. Otherwise, it would be conflict to #4.
I'll look into it after fully supporting GFM (v1.0.0).

@soasme soasme added help wanted Extra attention is needed enhancement New feature or request labels Oct 24, 2018
@soasme
Copy link
Owner

soasme commented Sep 24, 2019

Close this issue. Nim-markdown is aimed to support commonmark & gfm as of now. File transclusion is not in these specs. It's encouraging to implement it as an extension in library users' projects.

I've added a section to advance usages: Customize Parsing. It provides an example on parsing and rendering for content like #include "filename.md". You can follow the same pattern to support rules such as {{ filename.md }}.

@soasme soasme closed this as completed Sep 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants