Skip to content

Instantly share code, notes, and snippets.

@JJ
Last active November 23, 2022 10:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JJ/1e03af7cdd9d64799e832a3216aeeb26 to your computer and use it in GitHub Desktop.
Save JJ/1e03af7cdd9d64799e832a3216aeeb26 to your computer and use it in GitHub Desktop.
Extract heading from a markdown-marked letter
use Text::Markdown;
sub MAIN( Str $letter-to-santa = 'letters/dear-santa.md' ) {
my $letter = Text::Markdown::Document.new($letter-to-santa.IO.slurp());
say so $letter.items.grep( { $^þ ~~ Text::Markdown::Heading } );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment