Merge pull request #417 from xwiki-labs/stripTag

Strip tags
This commit is contained in:
ansuz
2019-08-08 17:23:17 +02:00
committed by GitHub
3 changed files with 16 additions and 8 deletions

View File

@@ -99,9 +99,17 @@ define([
// lines beginning with a hash are potentially valuable
// works for markdown, python, bash, etc.
var hash = /^#+(.*?)$/;
var hashAndLink = /^#+\s*\[(.*?)\]\(.*\)\s*$/;
if (hash.test(line)) {
// test for link inside the title, and set text just to the name of the link
if (hashAndLink.test(line)) {
line.replace(hashAndLink, function (a, one) {
text = Util.stripTags(one);
});
return true;
}
line.replace(hash, function (a, one) {
text = one;
text = Util.stripTags(one);
});
return true;
}