-
-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
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; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
=title Convert Markdown to HTML | ||
=timestamp 2024-02-22T10:30:01 | ||
=indexes PerlMaven | ||
=status show | ||
=tags markdown, html | ||
=author szabgab | ||
=archive 1 | ||
=description Convert Markdown including tables to HTML | ||
=comments_disqus_enable 0 | ||
=show_related 1 | ||
|
||
=abstract start | ||
|
||
I have lots of documents written in Markdown format and I was looking for a way to convert them to HTML. | ||
|
||
=abstract end | ||
|
||
First I tried the <a href="https://metacpan.org/pod/Text::Markdown">Text::Markdown</a> module, it seemed like the obvious pick. Onfortunately it did not handle | ||
tables. | ||
|
||
Then I found <a href="https://metacpan.org/pod/Text::MultiMarkdown">Text::MultiMarkdown</a> and that worked as I expected. | ||
|
||
<include file="examples/markdown.pl"> | ||
|