Skip to content

Commit 88365ec

Browse files
committed
Fix doc version issues
1 parent b561666 commit 88365ec

File tree

5 files changed

+26
-26
lines changed

5 files changed

+26
-26
lines changed

docs/2.5/configuration.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ $config = [
2626
'html_input' => 'escape',
2727
'allow_unsafe_links' => false,
2828
'max_nesting_level' => PHP_INT_MAX,
29-
'max_delimiters_per_line' => PHP_INT_MAX,
3029
'slug_normalizer' => [
3130
'max_length' => 255,
3231
],
@@ -73,7 +72,6 @@ Here's a list of the core configuration options available:
7372
- `escape` - Escape all HTML
7473
- `allow_unsafe_links` - Remove risky link and image URLs by setting this to `false` (default: `true`)
7574
- `max_nesting_level` - The maximum nesting level for blocks (default: `PHP_INT_MAX`). Setting this to a positive integer can help protect against long parse times and/or segfaults if blocks are too deeply-nested.
76-
- `max_delimiters_per_line` - The maximum number of delimiters (e.g. `*` or `_`) allowed in a single line (default: `PHP_INT_MAX`). Setting this to a positive integer can help protect against long parse times and/or segfaults if lines are too long.
7775
- `slug_normalizer` - Array of options for configuring how URL-safe slugs are created; see [the slug normalizer docs](/2.5/customization/slug-normalizer/#configuration) for more details
7876
- `instance` - An alternative normalizer to use (defaults to the included `SlugNormalizer`)
7977
- `max_length` - Limits the size of generated slugs (defaults to 255 characters)

docs/2.5/security.md

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ In order to be fully compliant with the CommonMark spec, certain security settin
1111
- `html_input`: How to handle raw HTML
1212
- `allow_unsafe_links`: Whether unsafe links are permitted
1313
- `max_nesting_level`: Protect against long render times or segfaults
14-
- `max_delimiters_per_line`: Protect against long parse times or rendering segfaults
1514

1615
Further information about each option can be found below.
1716

@@ -88,25 +87,6 @@ echo $converter->convert($markdown);
8887

8988
See the [configuration](/2.5/configuration/) section for more information.
9089

91-
## Max Delimiters Per Line
92-
93-
Similarly to the maximum nesting level, **no maximum number of delimiters per line is enforced by default.** Delimiters can be nested (like `*a **b** c*`) or un-nested (like `*a* *b* *c*`) - in either case, having too many in a single line can result in long parse times. We therefore have a separate option to limit the number of delimiters per line.
94-
95-
If you need to parse untrusted input, consider setting a reasonable `max_delimiters_per_line` (perhaps 100-1000) depending on your needs. Once this level is hit, any subsequent delimiters on that line will be rendered as plain text.
96-
97-
### Example - Prevent too many delimiters
98-
99-
```php
100-
use League\CommonMark\CommonMarkConverter;
101-
102-
$markdown = '*a* **b *c **d** c* b**'; // 8 delimiters (* and **)
103-
104-
$converter = new CommonMarkConverter(['max_delimiters_per_line' => 6]);
105-
echo $converter->convert($markdown);
106-
107-
// <p><em>a</em> **b *c <strong>d</strong> c* b**</p>
108-
```
109-
11090
## Additional Filtering
11191

11292
Although this library does offer these security features out-of-the-box, some users may opt to also run the HTML output through additional filtering layers (like HTMLPurifier). If you do this, make sure you **thoroughly** test your additional post-processing steps and configure them to work properly with the types of HTML elements and attributes that converted Markdown might produce, otherwise, you may end up with weird behavior like missing images, broken links, mismatched HTML tags, etc.

docs/2.6/configuration.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ $config = [
2727
'html_input' => 'escape',
2828
'allow_unsafe_links' => false,
2929
'max_nesting_level' => PHP_INT_MAX,
30+
'max_delimiters_per_line' => PHP_INT_MAX,
3031
'slug_normalizer' => [
3132
'max_length' => 255,
3233
],
@@ -73,7 +74,8 @@ Here's a list of the core configuration options available:
7374
- `escape` - Escape all HTML
7475
- `allow_unsafe_links` - Remove risky link and image URLs by setting this to `false` (default: `true`)
7576
- `max_nesting_level` - The maximum nesting level for blocks (default: `PHP_INT_MAX`). Setting this to a positive integer can help protect against long parse times and/or segfaults if blocks are too deeply-nested.
76-
- `slug_normalizer` - Array of options for configuring how URL-safe slugs are created; see [the slug normalizer docs](/2.6/customization/slug-normalizer/#configuration) for more details
77+
- `max_delimiters_per_line` - The maximum number of delimiters (e.g. `*` or `_`) allowed in a single line (default: `PHP_INT_MAX`). Setting this to a positive integer can help protect against long parse times and/or segfaults if lines are too long.
78+
- `slug_normalizer` - Array of options for configuring how URL-safe slugs are created; see [the slug normalizer docs](/2.5/customization/slug-normalizer/#configuration) for more details
7779
- `instance` - An alternative normalizer to use (defaults to the included `SlugNormalizer`)
7880
- `max_length` - Limits the size of generated slugs (defaults to 255 characters)
7981
- `unique` - Controls whether slugs should be unique per `'document'` (default) or per `'environment'`; can be disabled with `false`

docs/2.6/security.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ In order to be fully compliant with the CommonMark spec, certain security settin
1111

1212
- `html_input`: How to handle raw HTML
1313
- `allow_unsafe_links`: Whether unsafe links are permitted
14-
- `max_nesting_level`: Protected against long render times or segfaults
14+
- `max_nesting_level`: Protect against long render times or segfaults
15+
- `max_delimiters_per_line`: Protect against long parse times or rendering segfaults
1516

1617
Further information about each option can be found below.
1718

@@ -88,6 +89,25 @@ echo $converter->convert($markdown);
8889

8990
See the [configuration](/2.6/configuration/) section for more information.
9091

92+
## Max Delimiters Per Line
93+
94+
Similarly to the maximum nesting level, **no maximum number of delimiters per line is enforced by default.** Delimiters can be nested (like `*a **b** c*`) or un-nested (like `*a* *b* *c*`) - in either case, having too many in a single line can result in long parse times. We therefore have a separate option to limit the number of delimiters per line.
95+
96+
If you need to parse untrusted input, consider setting a reasonable `max_delimiters_per_line` (perhaps 100-1000) depending on your needs. Once this level is hit, any subsequent delimiters on that line will be rendered as plain text.
97+
98+
### Example - Prevent too many delimiters
99+
100+
```php
101+
use League\CommonMark\CommonMarkConverter;
102+
103+
$markdown = '*a* **b *c **d** c* b**'; // 8 delimiters (* and **)
104+
105+
$converter = new CommonMarkConverter(['max_delimiters_per_line' => 6]);
106+
echo $converter->convert($markdown);
107+
108+
// <p><em>a</em> **b *c <strong>d</strong> c* b**</p>
109+
```
110+
91111
## Additional Filtering
92112

93113
Although this library does offer these security features out-of-the-box, some users may opt to also run the HTML output through additional filtering layers (like HTMLPurifier). If you do this, make sure you **thoroughly** test your additional post-processing steps and configure them to work properly with the types of HTML elements and attributes that converted Markdown might produce, otherwise, you may end up with weird behavior like missing images, broken links, mismatched HTML tags, etc.

docs/_data/menu.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version:
33
Getting Started:
44
'Overview': '/2.6/'
55
'Installation': '/2.6/installation/'
6-
'Upgrading from 2.3': '/2.6/upgrading/'
6+
'Upgrading from 2.5': '/2.6/upgrading/'
77
'Changelog': '/2.6/changelog/'
88
'Support': '/2.6/support/'
99
Usage:
@@ -50,7 +50,7 @@ version:
5050
Getting Started:
5151
'Overview': '/2.5/'
5252
'Installation': '/2.5/installation/'
53-
'Upgrading from 2.3': '/2.5/upgrading/'
53+
'Upgrading from 2.4': '/2.5/upgrading/'
5454
'Changelog': '/2.5/changelog/'
5555
'Support': '/2.5/support/'
5656
Usage:

0 commit comments

Comments
 (0)