-
-
Save librasteve/79a2731e699022ebbda737131b37c4f9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env raku | |
use MONKEY-SEE-NO-EVAL; | |
#| takes markdown file and evals all code lines delimited by '```' | |
sub MAIN( | |
$filename!, #= '/pathto/example.md' | |
) { | |
my @lines = $filename.IO.lines or die 'no file found'; | |
my $toggle = False; | |
my $code; | |
for @lines -> $line { | |
when $line ~~ /^ '```perl6'/ { $toggle = True } | |
when $line ~~ /^ '```'/ { $toggle = False } | |
when $toggle { $code ~= "$line\n" } | |
} | |
EVAL $code // warn "no code found"; | |
} | |
#`[ | |
##ramd - raku markdown Provides literate programming as the combination of markdown explanation and embedded raku code. | |
- write a regular markdown file with filetype '.md' | |
- place raku code in line-oriented triple backticks as perl6 | |
- go ./bin/ramd README.md to run the main README.md | |
- go [raws](./literature/raws.md) to link another md file | |
- go say qqx`./bin/ramd ./literature/raws.md`; to include it | |
#] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment