NAME

Markdown::Simple - Markdown to HTML

VERSION

Version 0.11

SYNOPSIS

This module was 100% generated using co-pilot with the prompt:

"create a simple markdown to html perl XS module that allows you to optionally enable each element of markdown. For example I can disable the parsing of image"

then:

"great now extend with table and a few of the other options like task list"

A few more prompts were needed to add ordered and unordered lists.

use Markdown::Simple;

markdown_to_html($markdown);

markdown_to_html($markdown, {
  images => 0, # disable images
  code => 0, # disable code blocks
  links => 0, # disable links
});

my $plain = strip_markdown($markdown);

DESCRIPTION

Markdown::Simple is a simple Perl XS module that converts Markdown text to HTML. It allows you to enable or disable specific Markdown features such as images, code blocks, links, and more.

FUNCTIONS

markdown_to_html

markdown_to_html($markdown, \%options);

Converts the given Markdown text to HTML. The second argument is an optional hash reference that allows you to enable or disable specific Markdown features.

The available options are:

strip_markdown

strip_markdown($markdown);

Removes all Markdown formatting from the given text, returning plain text.

  • preprocess - Enable or disable preprocessing (default: enabled). Replaces \r\n with \n

  • headers - Enable or disable header parsing (default: enabled)

  • images - Enable or disable image parsing (default: enabled)

  • code - Enable or disable code block parsing (default: enabled)

  • links - Enable or disable link parsing (default: enabled)

  • fenced_code - Enable or disable fenced code block parsing (default: enabled)

  • bold - Enable or disable bold text parsing (default: enabled)

  • italic - Enable or disable italic text parsing (default: enabled)

  • strikethrough - Enable or disable strikethrough text parsing (default: enabled)

  • task_lists - Enable or disable task list parsing (default: enabled)

  • unordered_lists - Enable or disable unordered list parsing (default: enabled)

  • ordered_lists - Enable or disable ordered list parsing (default: enabled)

  • tables - Enable or disable table parsing (default: enabled)

EXAMPLES

use Markdown::Simple qw(markdown_to_html);

my $markdown = "This is **bold** text and this is *italic* text.";
my $html = markdown_to_html($markdown);
print $html; # Outputs: This is <strong>bold</strong> text and this is <em>italic</em> text.

my $markdown_with_options = "![alt text](image.jpg)";
my $html_with_options = markdown_to_html($markdown_with_options, { images => 0 });
print $html_with_options; # Outputs: ![alt text](image.jpg)

AUTHOR

LNATION, <email at lnation.org>

BUGS

Please report any bugs or feature requests to bug-markdown-simple at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Markdown-Simple. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Markdown::Simple

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

This software is Copyright (c) 2025 by LNATION.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)