Skip to content

Commit 65e6080

Browse files
committed
fix(config): respect quotes in any bracket links
1 parent f3b6b08 commit 65e6080

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

eleventy.config.tracToHTML.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const rasterisks = /^\s*\* /
2-
const rheaders = /^ *(\=+) *([^\n\r]+) *\1? *$/
2+
const rheaders = /^ *(\=+) *([^\n\r]+?)[=\s]*$/
33
let listStarted = false
44

55
function escapeHTML(string) {
@@ -35,7 +35,7 @@ module.exports = function tracToHTML(text) {
3535
})
3636
// Linkify http links in brackets
3737
.replace(
38-
/(^|\s)\[(https?:\/\/[^\s\]]+)(?:\s+([^\]]+))?\]/g,
38+
/(^|\s)(?:\[https?:\/\/([^ ]+) "([^"]+)"\])|(?:\[https?:\/\/([^\s\]]+)(?: ([^\]]+))?\])/g,
3939
function (_match, space, url, text) {
4040
return `${
4141
space || ''
@@ -46,7 +46,7 @@ module.exports = function tracToHTML(text) {
4646
)
4747
// Linkify hash links in brackets
4848
.replace(
49-
/(^|\s)\[(#[^\s\]]+)(?:\s+([^\]]+))?\]/g,
49+
/(^|\s)(?:\[(#[^ ]+) "([^"]+)"\])|(?:\[(#[^\s\]]+)(?: ([^\]]+))?\])/g,
5050
function (_match, space, url, text) {
5151
return `${
5252
space || ''
@@ -57,7 +57,7 @@ module.exports = function tracToHTML(text) {
5757
)
5858
// Linkify CamelCase links in brackets
5959
.replace(
60-
/(^|\s)\[([A-Z][a-z]+[A-Z][\w#-]+)(?:\s+([^\]]+))?\]/g,
60+
/(^|\s)(?:\[([A-Z][a-z]+[A-Z][^ ]+) "([^"]+)"\])|(?:\[([A-Z][a-z]+[A-Z][^\s\]]+)(?: ([^\]]+))?\])/g,
6161
function (_match, space, page, text) {
6262
return `${space || ''}<a href="/wiki/${page}">${text || page}</a>`
6363
}
@@ -77,7 +77,7 @@ module.exports = function tracToHTML(text) {
7777
.replace(/#(\d+)(?!<=>)/g, `<a href="/ticket/$1">$&</a>`)
7878
// Linkify CamelCase to wiki
7979
.replace(
80-
/(^|\s)(!)?([A-Z][a-z]+[A-Z]\w+(?:#\w+)?)(?!\w)/g,
80+
/(^|\s)(!)?([A-Z][a-z]+[A-Z][\w:]+(?:#\w+)?)(?!\w)/g,
8181
function (_match, space, excl, page) {
8282
if (excl) {
8383
return `${space || ''}${page}`

0 commit comments

Comments
 (0)