I'm writing web pages in markdown and converting them to HTML using md2html
tool. I want to process the output HTML file and find any youtube link like this:
<a href="https://www.youtube.com/watch?v=abcdefgh887">https://www.youtube.com/watch?v=abcdefgh887</a>
and replace it with the embed code:
<iframe width="560" height="315" src="https://www.youtube.com/embed/abcdefgh887?controls=0" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
I toyed around a little with Grammars, mostly to get familiar with them, but concluded this probably isn't the ideal tool for the job. Plus I'd prefer to use existing modules that are easily adaptable to other similar tasks rather than roll my own half-baked solution.
Perl5 has some good tools for this kind of thing but I'd like to use a pure Raku solution so I can learn more Raku.
Any recommendations for good approaches to this problem?