summaryrefslogtreecommitdiffstats
path: root/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'helpers')
-rw-r--r--helpers/content.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/helpers/content.go b/helpers/content.go
index f2cfc9b0f..f12a55ba8 100644
--- a/helpers/content.go
+++ b/helpers/content.go
@@ -400,6 +400,9 @@ func (c ContentSpec) mmarkRender(ctx *RenderingContext) []byte {
// ExtractTOC extracts Table of Contents from content.
func ExtractTOC(content []byte) (newcontent []byte, toc []byte) {
+ if !bytes.Contains(content, []byte("<nav>")) {
+ return content, nil
+ }
origContent := make([]byte, len(content))
copy(origContent, content)
first := []byte(`<nav>