Fixes #5 - Support target blank for external links in markdown articles
This commit is contained in:
@@ -47,12 +47,17 @@ const createRevisionsFromFiles = (fileNames) => (
|
|||||||
const fm = frontmatter(data);
|
const fm = frontmatter(data);
|
||||||
// prepend subfolder to links
|
// prepend subfolder to links
|
||||||
fm.body = fm.body.replace(/\]\(\//g, '](/techradar/')
|
fm.body = fm.body.replace(/\]\(\//g, '](/techradar/')
|
||||||
|
|
||||||
|
// add target attribute to external links
|
||||||
|
let html = marked(fm.body);
|
||||||
|
html = html.replace(/a href="http/g, 'a target="_blank" href="http')
|
||||||
|
|
||||||
checkAttributes(fileName, fm.attributes);
|
checkAttributes(fileName, fm.attributes);
|
||||||
resolve({
|
resolve({
|
||||||
...itemInfoFromFilename(fileName),
|
...itemInfoFromFilename(fileName),
|
||||||
...fm.attributes,
|
...fm.attributes,
|
||||||
fileName,
|
fileName,
|
||||||
body: marked(fm.body),
|
body: html
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user