Skip to content

Commit 1b1e4cb

Browse files
authored
Merge pull request #40 from photogabble/patch/v1.1.0/#39
BUGFIX: encode link title html entities
2 parents e603481 + 399b55f commit 1b1e4cb

File tree

7 files changed

+216
-49
lines changed

7 files changed

+216
-49
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
- Bugfix HTML encode link titles (#40)
1011
- Bugfix broken dead-links lookup due to typo (#38)
1112
- Bugfix do not render embeds if the page linked doesn't exist (#35)
1213
- Bugfix do not parse links in pages excluded from collections (#30)

package-lock.json

Lines changed: 183 additions & 44 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@
4949
},
5050
"dependencies": {
5151
"chalk": "^4.1.1",
52-
"markdown-it": "^13.0.1"
52+
"entities": "^4.5.0",
53+
"markdown-it": "^14.1.0"
5354
},
5455
"devDependencies": {
5556
"@11ty/eleventy": "^2.0.0",

src/markdown-ext.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const chalk = require('chalk');
1+
const entities = require("entities");
22

33
/**
44
* This rule will be looped through an inline token by markdown-it.
@@ -70,7 +70,7 @@ const wikilinkRenderRule = (wikilinkParser, compiledEmbeds, opts) => (tokens, id
7070

7171
const anchor = {
7272
href: link.href,
73-
text: link.title ?? link.name,
73+
text: entities.encodeHTML(link.title ?? link.name),
7474
};
7575

7676
if (link.anchor) {

0 commit comments

Comments
 (0)