Download the PHP package semmelsamu/commonmark-extensions without Composer
On this page you can find all versions of the php package semmelsamu/commonmark-extensions. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download semmelsamu/commonmark-extensions
More information about semmelsamu/commonmark-extensions
Files in semmelsamu/commonmark-extensions
Package commonmark-extensions
Short Description Custom Markdown extensions for CommonMark PHP
License MIT
Informations about the package commonmark-extensions
CommonMark Extensions
Custom extensions for the CommonMark PHP Markdown parser. Extensions contained:
- Callout - Renders obsidian-like callout and github-like alarm blockquotes
- CodeHighlighting - Highlights code blocks using highlight.php
- LaTex - Escapes inline- and block-level latex code between dollar signs (
$) - Wikilink - Processes Wikilinks like in Obsidian
- WikilinkEmbed - Embeds Wikilinks prefixed with a
!
Installation
You can install this package with Composer (recommended):
Alternatively (not recommended), refer to the latest stable release and download the source code manually.
Setup
Usage
Callout
You may want to configure the extension:
render_icon- A closure expecting the callout type and returning valid HTML which will be rendered as the icon of the callout.
CodeHighlighting
You may want to download one of the various highlight.js themes in order to actually see any code highlighting, as this extension does not apply any colors to the code by itself, it only applies CSS classes. Download the css files here and load them in your HTML.
LaTex
You may want to download a LaTex highlighting engine like MathJax, as this extension does not render LaTex, but escapes it. Use the code below to load MathJax into your HTML:
Wikilink
You may want to configure the extension:
resolve- A closure expecting the wikilink text and returning the resolved href value which will be used in the<a>tag.- If using the Heading Permalink Extension, you want to set the
slug_normalizeroptionuniquetofalse, as else the Wikilink anchors will not link correctly to their respective headings.
WikilinkEmbed
You may want to configure the extension:
resolve- A closure expecting the wikilink text and returning the resolved href value which will be used in the<a>tag.
As a fallback, this extension already provides a basic iframe renderer for Embeds. You may add your own renderers with higher priority to extend this functionality. The example below shows an image renderer, so that images can also be written as wikilinks:
Testing
Formatting
This Project uses Laravel Pint:
License
This project is licenced under the MIT license. See the LICENSE file for more information.