Convert Markdown to HTML
I have lots of documents written in Markdown format and I was looking for a way to convert them to HTML.
First I tried the Text::Markdown module, it seemed like the obvious pick. Onfortunately it did not handle tables.
Then I found Text::MultiMarkdown and that worked as I expected.
examples/markdown.pl
use warnings; use strict; use feature 'say'; #use Text::Markdown qw(markdown); use Text::MultiMarkdown qw(markdown); my $text = <<ORIGINAL; # Title Some text ## Subtitle * Unordered * List * Items 1. Ordered 1. List 1. Items | name | number | | ---- | ------ | | Foo | 1234 | | Bar | 4 | <style> table td + td { text-align: right; } </style> ORIGINAL my $html = markdown($text); say $html;
Published on 2024-02-22
If you have any comments or questions, feel free to post them on the source of this page in GitHub. Source on GitHub.
Comment on this post