User Tools

Site Tools


res:plugins:parsedown

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
res:plugins:parsedown [2026/05/01 16:36] – [Changelog] fraenkimanres:plugins:parsedown [2026/05/01 21:18] (current) – [Description] fraenkiman
Line 12: Line 12:
   * Super Fast   * Super Fast
  
-  * Extensible+  * 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. Why Parsedown? It's faster, more consistent and is being actively developed.
Line 18: Line 18:
 [[https://parsedown.org/|Parsedown]] passes most [[https://parsedown.org/tests/|CommonMark tests]]. The tests that fail are more unusual cases. [[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. 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 ''<br>'' 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 ===== ===== Markdown syntax =====
Line 150: Line 188:
  
 ==== Tables with preformatted cells ==== ==== Tables with preformatted cells ====
 +Alignment markers:
 +'':—'' left aligned, ''—:'' right aligned, '':—:'' centred
 <code>| One        | Two  | <code>| One        | Two  |
 | :--        | :--  | | :--        | :--  |
Line 195: Line 235:
 [id]: http://example.com/ "Enter optional title here" [id]: http://example.com/ "Enter optional title here"
  
-## Header 1 ## {#header1+## Header 1 ## {#anchor
-[Link back to header 1](#header1)</code>+[Link back to header 1](#anchor)</code>
  
 ==== Automatic links ==== ==== Automatic links ====
Line 213: Line 253:
 __double underlines__  __double underlines__ 
  
-Lord*God*sacrament +Lord*God*Sacrament 
  
-\*This text is enclosed by asterisks.\* +This is ~~deleted text~~. 
 + 
 +\*This text is surrounded by literal asterisks.\*
  
 *italics*, **bold** and ***bold italics*** or  *italics*, **bold** and ***bold italics*** or 
Line 297: Line 339:
  
  
-===== License ===== +===== Parsedown Extra syntax ===== 
-[[https://github.com/erusev/parsedown/blob/master/LICENSE.txt|MIT]]+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 ====
 +<code>## Header with ID {#my-header}
  
-===== Requirements =====+## Header with class {.important} 
 + 
 +## Header with ID and class {#my-header .important}</code> 
 + 
 +Then link to the header with: 
 + 
 +<code>[Jump to the header](#my-header)</code> 
 + 
 +==== Special attributes for links and images ==== 
 +<code>[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}</code> 
 + 
 +This bundled Parsedown Extra implementation supports ''#id'' and ''.class'' tokens. It does not process arbitrary attributes such as ''lang=de''
 + 
 +==== Footnotes ==== 
 +<code>Text with a footnote.[^1] 
 + 
 +[^1]: This is the footnote text.</code> 
 + 
 +Footnotes are collected at the end of the parsed text. 
 + 
 +==== Definition lists ==== 
 +<code>Apple 
 +: Pomaceous fruit 
 +: Technology company 
 + 
 +Orange 
 +: Citrus fruit</code> 
 + 
 + 
 +==== Abbreviations ==== 
 +<code>*[HTML]: Hyper Text Markup Language 
 +*[W3C]: World Wide Web Consortium 
 + 
 +The HTML specification is maintained by the W3C.</code> 
 + 
 +Abbreviation definitions are removed from the output. Matching terms are rendered as ''<abbr>'' elements. 
 + 
 + 
 +===== License ===== 
 +[[https://github.com/erusev/parsedown/blob/master/LICENSE.txt|MIT]]
  
-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]] 
  
 ===== Download ===== ===== Download =====
Line 315: Line 396:
 == 2026-05-01: Version 1.1.3 == == 2026-05-01: Version 1.1.3 ==
   * Corrected incorrect documentation (anchor links)   * Corrected incorrect documentation (anchor links)
 +  * Documentation expanded to include the Parsedown Extra syntax
 == 2026-04-23: Version 1.1.2 == == 2026-04-23: Version 1.1.2 ==
   * Comments continue to be stored in a sanitized format. Only safe autolinks are restored immediately before parsing.   * Comments continue to be stored in a sanitized format. Only safe autolinks are restored immediately before parsing.
res/plugins/parsedown.1777646171.txt.gz · Last modified: by fraenkiman

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki