Description
I recently came across this tool:
It allows you to embed code-samples in markdown files, though it must be said it is very flexible and basically you give it an input-file which contains:
MARKER file|URL start-regexp end-regexp
The line will be replaced by content from the file-path, or the remote URL, between the start/end regexps. Pretty trivial to write this in perl, via the flip-flop operator:
That said it would be a nice addition here.
Something like:
sysbox embed file1.md > file1.out
The biggest, obvious, issue is that if you were to replace in-place, you'd lose the marker(s). So this example:
Hello I am header.
#marker: /etc/passwd /root/ /\n/
Could become:
Hello I am header
root:x:0:0:root:/root:/bin/bash
But then you're stuck! You can't replace the content again, because the edited-in-place file no longer has the marker. You probably don't want that marker inline anyway. Though you could have something like:
<div class="include" start="^root" end="\n" />
Which could remain. But that's getting a bit markdown-specific. I guess the real solution is that your repository would have README.in
(master-source) and README.md
(generated/expanded output).