Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@deskeen/markdown

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@deskeen/markdown - npm Package Compare versions

Comparing version 5.1.3 to 5.2.1

6

CHANGELOG.md
# 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 @@

4

package.json
{
"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 = `

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc