Markdown::Render(3pm)

Okay bestie, you're reading the User Contributed Perl Documentation manual page for Markdown::Render (3pm) β€” it's giving Perl module that renders markdown as HTML. Let's go. πŸ’…

✨ NAME ✨

Markdown::Render β€” renders markdown as HTML. That's the whole point, no cap. πŸŽ€

🌸 SYNOPSIS 🌸

So here's how you use it in Perl, bestie:

use Markdown::Render;

my $md = Markdown::Render->new( infile => 'README.md');

$md->render_markdown->print_html;

...or from the command line to create HTML, it's giving:

md-utils -r README.md > README.html

...or from the command line to replace render custom tags, like:

md-utils README.md.in > README.md

🌈 DESCRIPTION 🌈

Okay so this module renders markdown as HTML using either GitHub's API or Text::Markdown::Discount. Optionally, it adds additional metadata to your markdown document using custom tags. Obsessed. πŸ’–

See README.md at <https://github.com/rlauer6/markdown-utils/blob/master/README.md> for more details. That's the README for markdown-utils, iykyk.

Note: This module originally used Text::Markdown as an alternative to using the GitHub API, but bestie, there are too many bugs and idiosyncracies in that module. So now it uses Text::Markdown::Discount which is not only faster, but seems to be more compliant with GFM. Periodt. πŸ”₯
Note: Text::Markdown::Discount relies on the text-markdown library which did not actually support all of the markdown features (including code fencing). You can find an updated version of Text::Markdown::Discount here: <https://github.com/rlauer6/text-markdown-discount>. That's the tea. β˜•οΈ

πŸ’… METHODS AND SUBROUTINES πŸ’…

This is where the methods live. Let's get into it.

πŸŽ€ new πŸŽ€

new( options )

Any of the options passed to the new method can also be set or retrieved using the set_NAME or get_NAME methods. So like, set_css, get_engine, etc. Iykyk. ✨

Here are the options, bestie:

  • css β€” URL of a CSS file to add to the head section of the printed HTML. It's giving style. πŸ’…
  • engine β€” One of "github" or "text_markdown". Default: text_markdown. So if you don't pick, it's lowkey text_markdown. πŸŒ€
  • git_user β€” Name of the git user that is used in the "GIT_USER" tag. So when you use that tag, it gets replaced with this. 🧚
  • git_email β€” Email address of the git user that is used in the "GIT_EMAIL" tag. Same vibe. πŸ’Œ
  • infile β€” Path to a file in markdow format. (Yes, it says "markdow" in the original β€” typo and all, I'm keeping it. πŸ™ˆ) So like, your markdown file goes here.
  • markdown β€” Text of the markdown to be rendered. If you have the markdown as a string, this is your moment. πŸ“
  • mode β€” If using the GitHub API, mode can be either "gfm" or "markdown". Default: markdown. So if you're using the GitHub engine, you can pick. 🌟
  • no_title β€” Boolean that indicates that no title should be added to the table of contents. Default: false. So if you want no title in the TOC, set this to true. 🚫
  • title β€” Title to be used for the table of contents. Like, the heading for your TOC. πŸ‘‘

πŸ¦‹ finalize_markdown πŸ¦‹

This method updates the markdown by interpolating the custom keywords. Invoking this method will create a table of contents and replace keywords with their values. So it's doing the most: building your TOC and swapping in your custom tags. ✨

Invoke this method prior to invoking render_markdown. So like, do this first, then render. Order matters, bestie. πŸ”₯

It returns the Markdown::Render object. So you can chain, periodt. πŸ’…

🌸 render_markdown 🌸

This one passes the markdown to GitHub's markdown rendering engine. After invoking this method you can retrieve the processed html by invoking get_html or create a fully rendered HTML page using the print_html method. So you've got options. πŸŽ€

It returns the Markdown::Render object. Chainable, iconic. 🫢

print_html(options)

Outputs the fully rendered HTML page. It's giving final form. πŸ’…

Options:

  • css β€” URL of a CSS style sheet to include in the head section. If no CSS file option is passed, a default CSS file will be used. If a CSS element is passed but it is undefined or empty, then no CSS will be specified in the final document. So like, default CSS if you don't pass anything, but if you pass an empty one, no CSS at all. 🎨
  • title β€” Title to be added in the head section of the document. If no title option is passed, the name of the file will be used as the title. If a title option is passed but is undefined or empty, no title element will be added to the document. So default is filename, but empty title means no title tag. 🌟

πŸ‘‘ AUTHOR πŸ‘‘

Rob Lauer - rlauer6@comcast.net. That's the icon who made this. 🫢

🌈 LICENSE 🌈

This software is licensed under the same terms as Perl. So like, Perl's license, bestie. πŸ’…

⭐ SEE OTHER ⭐

That's the see also section. πŸ”₯


Okay bestie, that's the whole manual page for Markdown::Render (3pm). This version is from Perl v5.40.1, dated 2026-06-21. Now go slay your markdown rendering. πŸ’…βœ¨

πŸ“¦ where this page comes from