====== Parsedown ====== Author: [[https://frank-web.dedyn.io|Fraenkiman]], based on [[https://github.com/parsedown/parsedown|a fork]] of [[https://github.com/erusev/parsedown|Emanuil Rusev]] ===== Description ===== Parsedown is an efficient, modern PHP implementation of Markdown syntax originally developed by [[https://daringfireball.net/|John Gruber]]. * One file * No Dependencies * Super Fast * Extensible (For example, using [[https://github.com/BenjaminHoegh/ParsedownExtended|ParsedownExtended]] by Benjamin Høegh) Why Parsedown? It's faster, more consistent and is being actively developed. [[https://parsedown.org/|Parsedown]] passes most [[https://parsedown.org/tests/|CommonMark tests]]. The tests that fail are more unusual cases. However, as CommonMark continues to evolve, compliance should improve. ===== Requirements ===== You need: * a working ≥ [[en:doc:basic:upgrade|FlatPress 1.5.1 Stringendo]] installation * PHP **7.2 to 8.5** * the plugin files from [[res:plugins:parsedown#download|this package]] ===== How FlatPress uses the plugin ===== The plugin registers Markdown parsing for: * entries: ''the_content'' and ''the_content_rss'' * excerpts: ''the_excerpt'' and ''the_excerpt_rss'' * comments: ''comment_text'' FlatPress' default text formatting filters are removed before Parsedown runs, so that Markdown source is not changed into HTML paragraphs or smart typography too early. Parser configuration in this plugin: * safe mode is **off**: Parsedown itself does not remove raw HTML * markup escaping is **off**: raw HTML is kept unless another FlatPress/BBCode save-time filter escaped it before output * strict mode is **off**: Parsedown accepts some Markdown forms more generously * URL linking is **on**: absolute ''http://'' and ''https://'' URLs are linked automatically * automatic line breaks are **off**: a normal newline inside a paragraph stays a newline; use Markdown hard-break syntax when a ''
'' is required Security note: Enable raw HTML only for trusted authors. Comment text is still stored escaped by FlatPress; the plugin selectively restores only safe Markdown autolinks immediately before parsing. ===== Parsedown Extra availability ===== The plugin prefers Parsedown Extra when all of the following PHP features are available: * ''DOMDocument'' * ''DOMElement'' * ''libxml_use_internal_errors()'' If these PHP features are missing, the plugin falls back to plain Parsedown. In that fallback mode, the "[[res:plugins:parsedown#parsedown_extra_syntax|Parsedown Extra syntax]]" section below is not available. For example, ''# Heading {#id}'' will be rendered as a heading containing the literal text ''{#id}'' instead of creating an HTML ''id'' attribute. ===== Markdown syntax ===== ==== Headers (Setext) ==== This is an H1 =============== This is an H2 --------------- ==== Headers (atx) ==== # This is an H1 ## This is a H2 ###### This is a H6 # This is a H1 # ## This is a H2 ## ### This is a H3 ###### ==== Quotes ==== > This is a two paragraph quote. The customer should be very satisfied, > consectetuer adipiscing elit. I have decided to a policeman. Vestibulum enim visi, viverra nec, fringilla in, laoreet > vitae, risus. >> Until then, it will be fun. Some people always want to be very happy. > Suspendisse id sem consectetuer libero luctus adipiscing. > This is a two paragraph quote It is important to have good customer service, a customer service provider. I decided to use a policeman. For the vestibule, we saw: Viverra nec, Fringilla in, Laoreet vitae, Risus. > Until it's fun to play. Some people always want to be very happy. Suspendisse id sem consectetuer libero luctus adipiscing. > Today is the first day Quote level. > > > This is a nested quote >> Back to the first level > ## This is a headline > > 1. this is the first list item. > 2. this is the second list item > > Here is a small example code: > > return shell_exec("echo $input | $Markdown_script"); ==== Lists ==== * Red * Green * Blue + Red + green + Blue - red - green - blue 1. dog 2. cat 3. mouse * Lorem ipsum dolor let amet, consectetuer adipiscing elit. I decided to use a policeman. For the vestibule we have seen: Viverra nec, Fringilla in, Laoreet vitae, Risus. * Until it's fun to play. Some people always want to be very happy. Suspendisse id sem consectetuer libero luctus adipiscing. * Warsteiner * King * Warsteiner 2 * King 2 1 This is a list item with two paragraphs. It is important to, to have good customer service, a customer service provider. I decided to, to use a policeman. For the vestibule, we saw: Viverra nec, Fringilla in, Laoreet vitae, Risus. Until then, it will be fun. Some people always want to be very happy . 2 Suspendisse id sem consectetuer libero luctus adipiscing. * This is a two-paragraph list item. This is the second paragraph in this list item. Only the first line must be indented It is important to have good customer service, a customer service provider. * Another item in the same list. * A list item with a quote: > This is a quote > In a list. * A list item with a code example: ==== Simple tables ==== First Header | Second Header ------------- | ------------- Content Cell | Content Cell Content Cell | Content Cell | First Header | Second Header | | ------------- | ------------- | | Content Cell | Content Cell | | Content Cell | Content Cell | A colon at the left of the separator line will make the column left-aligned; a colon on the right of the line will make the column right-aligned; colons at both side means the column is center-aligned. | Item | Value | | --------- | -----:| | Computer | $1600 | | Phone | $12 | | Pipe | $1 | ==== Tables with preformatted cells ==== Alignment markers: '':—'' left aligned, ''—:'' right aligned, '':—:'' centred | One | Two | | :-- | :-- | | ```One``` | Two | | One | Two | | :-- | :-- | | One | ```Two``` | | One | Two | | :-- | :-- | | Only ```partially``` preformatted | Two | | One | Two | | :-- | :-- | | Only ```partially``` preformatted but ```twice``` | Two | Works only with version 1.1.0 or higher | One | Two | | :-- | :-- | | ```One``` | ```Two``` | | One | Two | Three | | :-- | :-- | :-- | | ```One``` | Two | ```Three``` | | One | Two | | :-- | :-- | | Only ```partially``` preformatted | ```Two``` | | One | Two | Three | | :-- | :-- | :-- | | One | ```Two``` | ```Three``` | ==== Links ==== This is [an example](http://example.com/ "The link title") for an inline link. an inline link. [This link](http://example.net/) has no title attribute There is more information on the [About me](/about/) page. This is [an example] [id] for a reference link [id]: http://example.com/ "Enter optional title here" ## Header 1 ## {#anchor} [Link back to header 1](#anchor) ==== Automatic links ==== ==== Emphasis ==== *Single asterisk* _Single underline_ **Double asterisks** __double underlines__ Lord*God*Sacrament This is ~~deleted text~~. \*This text is surrounded by literal asterisks.\* *italics*, **bold** and ***bold italics*** or _italic_, __bold__ and ___bold italic___ ==== Code ==== This is a normal paragraph. The tag is a code block. An example in AppleScript: tell application "Foo" beep end tell Use the `printf()` function to output text ``Somewhere here (`) a backtick is hidden.`` Nobody uses ``` tags ```` ```` This is a paragraph introducing: ~~~~~~~~~~~~~~~~~~~~~ a one-line code block ~~~~~~~~~~~~~~~~~~~~~ `````````````````` another code block `````````````````` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

paragraph emphasis ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

paragraph emphasis ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ==== Graphics ==== [Alternative text](https://www.flatpress.org/fp-interface/themes/official-site/imgs/fp-logo.png) [Alternative text](https://www.flatpress.org/fp-interface/themes/official-site/imgs/fp-logo.png "Optional title") ==== Images ==== Inline image syntax looks like this: ![Alt text](https://www.flatpress.org/fp-interface/themes/official-site/imgs/fp-logo.png) ![Alt text](https://www.flatpress.org/fp-interface/themes/official-site/imgs/fp-logo.png "Optional title") Inline image with external URL: [![Alt text](https://www.flatpress.org/fp-interface/themes/official-site/imgs/fp-logo.png "FlatPress-Logo")](https://google.com) ==== Backslash masking ==== \*Surrounded by asterisks\* ==== Bulleted lists nested in a numbered list ==== 1. fruit * Apple * Banana 2. vegetable - carrot - broccoli ==== Horizontal Rules ==== * * * *** ***** - - - ===== Parsedown Extra syntax ===== The syntax in this section works only when Parsedown Extra is active. See "[[res:plugins:parsedown#parsedown_extra_availability|Parsedown Extra availability]]" above. ==== Special attributes for headers ==== ## Header with ID {#my-header} ## Header with class {.important} ## Header with ID and class {#my-header .important} Then link to the header with: [Jump to the header](#my-header) ==== Special attributes for links and images ==== [FlatPress](https://www.flatpress.org/){#flatpress-link .button} ![Logo](https://www.flatpress.org/fp-interface/themes/official-site/imgs/fp-logo.png){#fp-logo .logo} This bundled Parsedown Extra implementation supports ''#id'' and ''.class'' tokens. It does not process arbitrary attributes such as ''lang=de''. ==== Footnotes ==== Text with a footnote.[^1] [^1]: This is the footnote text. Footnotes are collected at the end of the parsed text. ==== Definition lists ==== Apple : Pomaceous fruit : Technology company Orange : Citrus fruit ==== Abbreviations ==== *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium The HTML specification is maintained by the W3C. Abbreviation definitions are removed from the output. Matching terms are rendered as '''' elements. ===== License ===== [[https://github.com/erusev/parsedown/blob/master/LICENSE.txt|MIT]] ===== Download ===== {{ res:plugins:frank:parsedown1_1_3.zip|}} ===== Changelog ===== == 2026-05-01: Version 1.1.3 == * Corrected incorrect documentation (anchor links) * Documentation expanded to include the Parsedown Extra syntax == 2026-04-23: Version 1.1.2 == * Comments continue to be stored in a sanitized format. Only safe autolinks are restored immediately before parsing. == 2026-03-25: Version 1.1.1 == * Parsedown no longer breaks up BBCode lists in comments == 2026-03-04: Version 1.1.0 == * Parsedown Extra (0.9.0) added * Markdown support in comments == 2025-12-17: Version 1.0.1 == * PHP 8.5 compatibility == 2025-03-03: Version 1.0.0 == * Initial release **Support** Please ask for help on the [[https://forum.flatpress.org/viewtopic.php?t=856|FlatPress Forum]]