From c60f25fb7c52b2c30e07a666f538445c2371af87 Mon Sep 17 00:00:00 2001 From: zadam Date: Tue, 10 Jan 2023 00:00:46 +0100 Subject: [PATCH] more flexible heading regex --- src/public/app/widgets/toc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/public/app/widgets/toc.js b/src/public/app/widgets/toc.js index 1e9dfeb4c..0c49d545f 100644 --- a/src/public/app/widgets/toc.js +++ b/src/public/app/widgets/toc.js @@ -126,7 +126,7 @@ export default class TocWidget extends CollapsibleWidget { getToc(html) { // Regular expression for headings

...

using non-greedy // matching and backreferences - const headingTagsRegex = /(.*?)<\/h\1>/g; + const headingTagsRegex = /]*>(.*?)<\/h\1>/g; // Use jquery to build the table rather than html text, since it makes // it easier to set the onclick event that will be executed with the