To support Markdown syntax in the Cotonti CMS, the Parsedown parser plugin is used. It converts Markdown markup into HTML when content is displayed. By default, Cotonti is oriented toward HTML/BBCode, but the extension architecture makes it easy to switch to Markdown using this plugin.
1. Installing the Markdown Parser Parsedown 1.8.0 Plugin
To make your Cotonti site understand Markdown markup, follow these steps:
1. Download the extension
- Go to the online marketplace of extensions for Cotonti — here you will always find links to the up-to-date source code of plugins, modules, themes, and templates.
- On the extension page, if it is free, there is always a “Resources” button — it opens the public source code repository on :octocat: GitHub.
- On the repository page, click the Code button and select Download ZIP from the dropdown list.
2. Uploading to the server
- First of all, make a backup of your website and database.
- Unpack the archive and copy the
parsedownandhtmlpurifierfolders into theplugins/directory on your server.
Attention! Three files in the
htmlpurifierfolder will be overwritten. Be sure to read the Website Security Guide.
3. Activation
- Go to the Administration Panel of your site.
- Open the Extensions section.
- Find the HTML Purifier plugin, open it and click “Update”.
- Find the new Parsedown Markdown plugin in the list and click “Install”.
- You can leave the Parsedown Markdown settings at their defaults or configure them as shown in the screenshots.
4. Setting the default parser
- Go to the configuration of the “Pages” module and set the default parser to
parsedown, then click “Update”. - For the Market PRO module this is not required — it will pick up the parser automatically if you have the latest version of the module.
5. Clearing template cache and applying updates
- If you use Cloudflare services:
Domains→Overview→ your domain →Caching→Configuration→ Purge Everything. - In the site admin panel: Other → Disk Cache → Clear All.
- Open the public part of the site, hold
Ctrland pressF5twice. - Create a new page or edit an existing one, select
parsedownin the “Parser” field, paste your text and save it (see the screenshots).
Attention! In the products module, changing the parser from the dropdown list may cause a page reload without saving the data. Therefore always do it this way:
- Select and set the parser.
- Paste and edit the text.
- Only then save.
Otherwise you will lose the unsaved form data.
Cheat Sheet of Basic Markdown Syntax in Cotonti
After activating the plugin you will be able to format text pages using standard Markdown tags.
Full table of the main Markdown elements
| Element | Markdown Syntax | HTML Result |
|---|---|---|
| Heading 1 | # Heading | <h1>Heading</h1> |
| Heading 2 | ## Heading | <h2>Heading</h2> |
| Heading 3 | ### Heading | <h3>Heading</h3> |
| Heading 4 | #### Heading | <h4>Heading</h4> |
| Heading 5 | ##### Heading | <h5>Heading</h5> |
| Heading 6 | ###### Heading | <h6>Heading</h6> |
| Bold text | **text** or __text__ | <strong>text</strong> |
| Italic | *text* or _text_ | <em>text</em> |
| Bold + Italic | ***text*** or ___text___ | <strong><em>text</em></strong> |
| Strikethrough | ~~text~~ | <del>text</del> |
| Link | [Text](https://url.com) | <a href="https://url.com">Text</a> |
| Link with title | [Text](https://url.com "Tooltip") | <a href="https://url.com" title="Tooltip">Text</a> |
| Image |  | <img src="https://image.png" alt="Alt"> |
| Unordered list | * Item 1* Item 2 | <ul><li>Item 1</li><li>Item 2</li></ul> |
| Ordered list | 1. Item 12. Item 2 | <ol><li>Item 1</li><li>Item 2</li></ol> |
| Nested list | * Item* Subitem | <ul><li>Item<ul><li>Subitem</li></ul></li></ul> |
| Quote | > Quote text | <blockquote>Quote text</blockquote> |
| Multi-line quote | > Line 1> Line 2 | <blockquote><p>Line 1</p><p>Line 2</p></blockquote> |
| Inline code | `code` | <code>code</code> |
| Code block | ```languagecode``` | <pre><code class="language-language">code</code></pre> |
| Horizontal rule | --- or *** or ___ | <hr> |
| Table | \| Column 1 \| Column 2 \|\|-------\|-------\|\| Cell \| Cell \| | <table>...</table> |
| Checkbox (task) | - [ ] Task- [x] Done | <ul><li><input type="checkbox"> Task</li>...</ul> |
| Footnote | Text[^1][^1]: Description | Text1 + footnote at the bottom |
| Escaping | \*text\* | *text* (characters without formatting) |
Additionally
- Line break: two spaces at the end of a line or
<br> - Paragraph: empty line between paragraphs →
<p>...</p> - HTML inside Markdown: most HTML tags work directly.
If you encounter any difficulties
Forum for custom plugins for Cotonti — you can ask any question, but please make it specific and not for mind-readers.
Personal help and/or support with the active participation of the developer — write to me privately using any contacts from my public profile.
Plugin in the marketplace of extensions for CMF Cotonti.