Skip to content

Commit

Permalink
Merge pull request #40 from photogabble/patch/v1.1.0/#39
Browse files Browse the repository at this point in the history
BUGFIX: encode link title html entities
  • Loading branch information
carbontwelve authored May 3, 2024
2 parents e603481 + 399b55f commit 1b1e4cb
Show file tree
Hide file tree
Showing 7 changed files with 216 additions and 49 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- Bugfix HTML encode link titles (#40)
- Bugfix broken dead-links lookup due to typo (#38)
- Bugfix do not render embeds if the page linked doesn't exist (#35)
- Bugfix do not parse links in pages excluded from collections (#30)
Expand Down
227 changes: 183 additions & 44 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
},
"dependencies": {
"chalk": "^4.1.1",
"markdown-it": "^13.0.1"
"entities": "^4.5.0",
"markdown-it": "^14.1.0"
},
"devDependencies": {
"@11ty/eleventy": "^2.0.0",
Expand Down
4 changes: 2 additions & 2 deletions src/markdown-ext.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const chalk = require('chalk');
const entities = require("entities");

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

const anchor = {
href: link.href,
text: link.title ?? link.name,
text: entities.encodeHTML(link.title ?? link.name),
};

if (link.anchor) {
Expand Down
Loading

0 comments on commit 1b1e4cb

Please sign in to comment.