DEV Community

Alexey Melezhik
Alexey Melezhik

Posted on

1

Sparrow plugin to convert markdown to pdf

Hi! Sparrow is a wonderful framework allows you to do all sorts of automation. Recently I've released a couple of new plugins to convert markdown text to pdf.

This could be quite handy if you keep your CV in markdown format as me, and then want to convert it into pdf for recruiters.


Here is a simple example of Raku code:

.tom/markdown-to-pdf.pl6:

my %state =  task-run "readme html", "text-markdown", %(
  file => "README.md"
);

"README.html".IO.spurt(%state<html>);

say "<README.html> updated";

task-run "html-to-pdf", "weasyprint", %(
  in => "README.html",
  out => "Aleksei Melezhik CV.pdf"
);

say "<Aleksei Melezhik CV.pdf> updated";
Enter fullscreen mode Exit fullscreen mode

And how to run it:

[root@bdcaf22ac901 cv]# tom  markdown-to-pdf
[repository] :: index updated from file:///root/repo/api/v1/index
[readme html] :: convert README.md, write to /root/.sparrow6/tmp/698215/out.html
<README.html> updated
[html-to-pdf] :: stderr: ++ weasyprint README.html 'Aleksei Melezhik CV.pdf'
[html-to-pdf] :: <empty stdout>
<Aleksei Melezhik CV.pdf> updated
Enter fullscreen mode Exit fullscreen mode

The plugins require some CPAN and pip modules under the hood ( if one reads about Sparrow - it's super good in gluing things ), but an end user should not worry about that, the mentioned code should work as is, Sparrow will take care about dependencies.

I'd like users would tell me what they think about this tool.

Thanks

Alexey

Do your career a big favor. Join DEV. (The website you're on right now)

It takes one minute, it's free, and is worth it for your career.

Get started

Community matters

Top comments (0)

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay