Closed codetrainee closed 5 years ago
I'm afraid that is expected. All formatting will be removed in the floating TOC. I guess this could be fixed (use node.innerHTML
instead of node.innerText
in JS), but I don't have time for it. Sorry.
Update
Based on Yihui's advice, the item.html(self.html)
is utilised to avoid the undesirable effect that may be introduced by <p>
tag.
if (this.options.theme !== "bootstrap3") {
item.append($("<a/>", {
"html": self.html()
}));
} else {
item.html(self.html());
}
Hi Yihui,
Thanks for your advice. I've figured out a workaround here.
We need to modified the jquery.tocify.js
file:
if (this.options.theme !== "bootstrap3") {
item.append($("<a/>", {
"html": self.html()
}));
} else {
item.append($("<p/>", {
"html": self.html()
}));
}
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.
Enabling
toc_float
strips the text format such as italic, blod or superscript.