0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Disable fuzzy auto-linking of URLs in markdown preview (#884)

refs https://github.com/TryGhost/Ghost/issues/8987

- set `linkify-it` `fuzzyLink` option to false so that it only auto-links URLs starting with `http(s)://` or other valid schemes
This commit is contained in:
Kevin Ansfield 2017-10-03 11:14:40 +01:00 committed by Katharina Irrgang
parent 5fae14fa74
commit b1ae1dbcdd

View file

@ -40,7 +40,6 @@ let markdownitNamedHeaders = function markdownitNamedHeaders(md) {
}; };
}; };
// eslint-disable-next-line new-cap
let md = markdownit({ let md = markdownit({
html: true, html: true,
breaks: true, breaks: true,
@ -51,6 +50,11 @@ let md = markdownit({
.use(markdownitMark) .use(markdownitMark)
.use(markdownitNamedHeaders); .use(markdownitNamedHeaders);
// configure linkify-it
md.linkify.set({
fuzzyLink: false
});
export default function formatMarkdown(_markdown, replaceJS = true) { export default function formatMarkdown(_markdown, replaceJS = true) {
let markdown = _markdown || ''; let markdown = _markdown || '';
let escapedhtml = ''; let escapedhtml = '';