Skip to content

Commit 9fad6b6

Browse files
committed
Update docs and CHANGELOG
1 parent d45a244 commit 9fad6b6

File tree

4 files changed

+64
-0
lines changed

4 files changed

+64
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ Updates should follow the [Keep a CHANGELOG](https://keepachangelog.com/) princi
66

77
## [Unreleased][unreleased]
88

9+
### Added
10+
- Added a new `HighlightExtension` for marking important text using `==` syntax (#1100)
11+
912
## [2.7.0]
1013

1114
This is a **security release** to address a potential cross-site scripting (XSS) vulnerability when using the `AttributesExtension` with untrusted user input.

docs/2.x/extensions/highlight.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
layout: default
3+
title: Highlight Extension
4+
description: The HighlightExtension allows marking important text.
5+
redirect_from:
6+
- /extensions/highlight/
7+
---
8+
9+
# Highlight Extension
10+
11+
This extension adds support for highlighting important text using the `==` syntax. For example, the Markdown:
12+
13+
```markdown
14+
I need to highlight these ==very important words==.
15+
```
16+
17+
Would be rendered to HTML as:
18+
19+
```html
20+
<p>I need to highlight these <mark>very important words</mark>.</p>
21+
```
22+
23+
Which could then be styled using CSS to produce a highlighter effect.
24+
25+
## Installation
26+
27+
This extension is bundled with `league/commonmark`. This library can be installed via Composer:
28+
29+
```bash
30+
composer require league/commonmark
31+
```
32+
33+
See the [installation](/2.x/installation/) section for more details.
34+
35+
## Usage
36+
37+
This extension can be added to any new `Environment`:
38+
39+
```php
40+
use League\CommonMark\Environment\Environment;
41+
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;
42+
use League\CommonMark\Extension\Highlight\HighlightExtension;
43+
use League\CommonMark\MarkdownConverter;
44+
45+
// Define your configuration, if needed
46+
$config = [];
47+
48+
// Configure the Environment with all the CommonMark parsers/renderers
49+
$environment = new Environment($config);
50+
$environment->addExtension(new CommonMarkCoreExtension());
51+
52+
// Add this extension
53+
$environment->addExtension(new HighlightExtension());
54+
55+
// Instantiate the converter engine and start converting some Markdown!
56+
$converter = new MarkdownConverter($environment);
57+
echo $converter->convert('I need to highlight these ==very important words==.');
58+
```

docs/2.x/extensions/overview.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ to enhance your experience out-of-the-box depending on your specific use-cases.
4040
| [Front Matter] | Parses YAML front matter from your Markdown input | `2.0.0` | |
4141
| **[GitHub Flavored Markdown]** | Enables full support for GFM. Automatically includes the extensions noted in the `GFM` column (though you can certainly add them individually if you wish): | `1.3.0` | |
4242
| [Heading Permalinks] | Makes heading elements linkable | `1.4.0` | |
43+
| [Highlight] | Mark text as being highlighted for reference or notation purposes | `2.8.0` | |
4344
| [Inlines Only] | Only includes standard CommonMark inline elements - perfect for handling comments and other short bits of text where you only want bold, italic, links, etc. | `1.3.0` | |
4445
| [Mentions] | Easy parsing of `@mention` and `#123`-style references | `1.5.0` | |
4546
| [Strikethrough] | Allows using tilde characters (`~~`) for ~strikethrough~ formatting | `1.3.0` | <i class="fab fa-github"></i> |
@@ -121,6 +122,7 @@ See the [Custom Extensions](/2.x/customization/extensions/) page for details on
121122
[Front Matter]: /2.x/extensions/front-matter/
122123
[GitHub Flavored Markdown]: /2.x/extensions/github-flavored-markdown/
123124
[Heading Permalinks]: /2.x/extensions/heading-permalinks/
125+
[Highlight]: /2.x/extensions/highlight/
124126
[Inlines Only]: /2.x/extensions/inlines-only/
125127
[Mentions]: /2.x/extensions/mentions/
126128
[Strikethrough]: /2.x/extensions/strikethrough/

docs/_data/menu.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ version:
2525
'Footnotes': '/2.x/extensions/footnotes/'
2626
'Front Matter': '/2.x/extensions/front-matter/'
2727
'Heading Permalinks': '/2.x/extensions/heading-permalinks/'
28+
'Highlight': '/2.x/extensions/highlight/'
2829
'Inlines Only': '/2.x/extensions/inlines-only/'
2930
'Mentions': '/2.x/extensions/mentions/'
3031
'Smart Punctuation': '/2.x/extensions/smart-punctuation/'

0 commit comments

Comments
 (0)