Skip to content

Commit 51e5aa9

Browse files
committed
feat: escapeAutoLinks utility
We need this to escape any text that might automatically be converted to links and generate broken links. See https://docs.asciidoctor.org/asciidoc/latest/macros/autolinks/
1 parent 46ed205 commit 51e5aa9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

util/jsonpath-util.js

+7
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@ module.exports = {
6161
return text ? text.split('{').join('\\{') : text
6262
},
6363

64+
escapeAutoLinks: (text) => {
65+
return text ? text
66+
.replaceAll(/ (http|https|ftp|irc|mailto|file):\/\//g, ' \\$1://')
67+
.replaceAll(/ (\b[\w\.\/\-\+]+@[\w\.\/\-]+\b)/g, ' \\$1')
68+
: text
69+
},
70+
6471
extractSBName: (resourceid) => {
6572
const m =resourceid.match(RESOURCEID_RX)
6673
return m ? m[1] : 'no match'

0 commit comments

Comments
 (0)