mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
bugfix: escape special symbols (&) in TOC during generation
This commit is contained in:
parent
7d05f96f94
commit
4c63839c4d
@ -60,7 +60,7 @@ mdit = mdit.use(window.markdownitHeadingAnchor, {
|
||||
toc.push({
|
||||
level: getHeadingLevel(openToken.tag),
|
||||
anchor: anchor,
|
||||
title: inlineToken.content
|
||||
title: escapeHtml(inlineToken.content)
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -313,3 +313,16 @@ var insertImageCaption = function() {
|
||||
var finishLogics = function() {
|
||||
content.finishLogics();
|
||||
};
|
||||
|
||||
// Escape @text to Html.
|
||||
var escapeHtml = function(text) {
|
||||
var map = {
|
||||
'&': '&',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
'"': '"',
|
||||
"'": '''
|
||||
};
|
||||
|
||||
return text.replace(/[&<>"']/g, function(m) { return map[m]; });
|
||||
};
|
||||
|
@ -24,7 +24,7 @@ var parseHeadings = function(html) {
|
||||
toc.push({
|
||||
level: level,
|
||||
anchor: ele.id,
|
||||
title: ele.innerText
|
||||
title: ele.innerHTML
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -43,8 +43,8 @@ VEditWindow::VEditWindow(VNote *vnote, VEditArea *editArea, QWidget *parent)
|
||||
void VEditWindow::initTabActions()
|
||||
{
|
||||
m_locateAct = new QAction(QIcon(":/resources/icons/locate_note.svg"),
|
||||
tr("Locate To Directory"), this);
|
||||
m_locateAct->setToolTip(tr("Locate the directory of current note"));
|
||||
tr("Locate To Folder"), this);
|
||||
m_locateAct->setToolTip(tr("Locate the folder of current note"));
|
||||
connect(m_locateAct, &QAction::triggered,
|
||||
this, &VEditWindow::handleLocateAct);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user