Skip to content

Commit 11a8c0f

Browse files
committed
Workaround cheerio text method shouldn't preserve html tags on fetching note title
1 parent 7e7919c commit 11a8c0f

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

lib/models/note.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ var async = require('async');
1313
var moment = require('moment');
1414
var DiffMatchPatch = require('diff-match-patch');
1515
var dmp = new DiffMatchPatch();
16+
var S = require('string');
1617

1718
// core
1819
var config = require("../config.js");
@@ -234,7 +235,7 @@ module.exports = function (sequelize, DataTypes) {
234235
var $ = cheerio.load(md.render(body));
235236
var h1s = $("h1");
236237
if (h1s.length > 0 && h1s.first().text().split('\n').length == 1)
237-
title = h1s.first().text();
238+
title = S(h1s.first().text()).stripTags().s;
238239
}
239240
if (!title) title = "Untitled";
240241
return title;

0 commit comments

Comments
 (0)