@deskeen/markdown
Advanced tools
Comparing version 5.1.3 to 5.2.1
# Changelog | ||
## 5.2.1 - 2023-08-24 | ||
**🌟 New** | ||
- Formatted text is supported in headers (behind `allowHeaderFormat` flag). | ||
- `allowHeaderFormat` parser option is added. | ||
## 5.1.3 - 2021-06-06 | ||
@@ -4,0 +10,0 @@ |
{ | ||
"name": "@deskeen/markdown", | ||
"version": "5.1.3", | ||
"version": "5.2.1", | ||
"description": "Node.js Markdown to HTML Parser", | ||
"author": "Morgan Schmiedt", | ||
"license": "MIT", | ||
"repository": "https://github.com/deskeen/markdown", | ||
"repository": "https://github.com/MorganSchmiedt/markdown", | ||
"keywords": [ | ||
@@ -9,0 +9,0 @@ "markdown", |
@@ -90,3 +90,4 @@ # Parseur Markdown vers HTML pour Node.js | ||
Les options disponibles sont: | ||
- `allowHeader`: Si les titres headers sont autorisés. `true` par défaut. | ||
- `allowHeader`: Si les titres sont autorisés. `true` par défaut. | ||
- `allowHeaderFormat`: Si du texte formaté est aurotisé dans les titres. `false` par défaut. | ||
- `allowLink`: Si les liens sont autorisés. `true` par défaut. | ||
@@ -764,3 +765,3 @@ - `allowImage`: Si les images sont autorisées. `true` par défaut. | ||
| Indice | N/A | ⚠ HTML | ☑ N/A | ⚠ HTML | ⚠ N/A | | ||
| Note bas page| `[^1]` | ⚠ N/A | ⚠ N/A | ⚠ Diff. | ⚠ N/A | | ||
| Note bas page| `[^1]` | ☑ | ⚠ N/A | ⚠ Diff. | ⚠ N/A | | ||
| HTML | N/A | ⚠ Av. | ☑ N/A | ⚠ Av. | ⚠ Av. | | ||
@@ -767,0 +768,0 @@ |
@@ -92,2 +92,3 @@ # Node.js Markdown to HTML Parser | ||
- `allowHeader`: Whether headers are allowed. Defaults to `true`. | ||
- `allowHeaderFormat`: Whether formatted text is allowed in headers. Defaults to `false`. | ||
- `allowLink`: Whether links are allowed. Defaults to `true`. | ||
@@ -763,3 +764,3 @@ - `allowImage`: Whether images are allowed. Defaults to `true`. | ||
| Subscript | N/A | ⚠ HTML | ☑ N/A | ⚠ HTML | ⚠ N/A | | ||
| Foonote | `[^1]` | ⚠ N/A | ⚠ N/A | ⚠ Diff. | ⚠ N/A | | ||
| Foonote | `[^1]` | ☑ | ⚠ N/A | ⚠ Diff. | ⚠ N/A | | ||
| HTML | N/A | ⚠ Av. | ☑ N/A | ⚠ Av. | ⚠ Av. | | ||
@@ -766,0 +767,0 @@ |
@@ -86,2 +86,3 @@ 'use strict' | ||
const allowHeader = parseBoolean(opt.allowHeader, true) | ||
const allowHeaderFormat = parseBoolean(opt.allowHeaderFormat, false) | ||
const allowLink = parseBoolean(opt.allowLink, true) | ||
@@ -180,8 +181,16 @@ const allowImage = parseBoolean(opt.allowImage, true) | ||
const headerNode = document.createElement(`H${headerLevel}`) | ||
headerNode.textContent = headerText | ||
headerNode.onAttach = opt.onHeader | ||
if (allowHeaderFormat) { | ||
lineCursor = 2 | ||
lastFlushCursor = lineCursor | ||
targetNode = headerNode | ||
caseFound = true | ||
} else { | ||
headerNode.textContent = headerText | ||
parseLine = false | ||
flushBody() | ||
} | ||
currentNode = headerNode | ||
parseLine = false | ||
flushBody() | ||
} | ||
@@ -188,0 +197,0 @@ } else if (firstChar === '!') { |
@@ -101,2 +101,26 @@ 'use strict' | ||
test('Header with bold text', function (t) { | ||
const input = '# A **bold** text' | ||
const opt = { | ||
allowHeaderFormat: true, | ||
} | ||
const output = '<h1>A <strong>bold</strong> text</h1>' | ||
t.equal(parseToHtml(input, opt), output, 'Output is valid') | ||
t.end() | ||
}) | ||
test('Header with link', function (t) { | ||
const input = '# A [link](https://example.com)' | ||
const opt = { | ||
allowHeaderFormat: true, | ||
} | ||
const output = '<h1>A <a href="https://example.com">link</a></h1>' | ||
t.equal(parseToHtml(input, opt), output, 'Output is valid') | ||
t.end() | ||
}) | ||
test('Header with allowHeader flag to false', function (t) { | ||
@@ -103,0 +127,0 @@ const input = ` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
167026
3248
917