mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
parent
0efb00c2a8
commit
c5f2f5837f
2 changed files with 4 additions and 5 deletions
|
@ -79,9 +79,8 @@ func (t *tocTransformer) Transform(n *ast.Document, reader text.Reader, pc parse
|
||||||
if found {
|
if found {
|
||||||
header.ID = string(id.([]byte))
|
header.ID = string(id.([]byte))
|
||||||
}
|
}
|
||||||
case ast.KindText:
|
case ast.KindText, ast.KindString:
|
||||||
textNode := n.(*ast.Text)
|
headingText.Write(n.Text(reader.Source()))
|
||||||
headingText.Write(textNode.Text(reader.Source()))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return s, nil
|
return s, nil
|
||||||
|
|
|
@ -32,7 +32,7 @@ func TestToc(t *testing.T) {
|
||||||
content := `
|
content := `
|
||||||
# Header 1
|
# Header 1
|
||||||
|
|
||||||
## First h2
|
## First h2---now with typography!
|
||||||
|
|
||||||
Some text.
|
Some text.
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ And then some.
|
||||||
got := b.(converter.TableOfContentsProvider).TableOfContents().ToHTML(2, 3)
|
got := b.(converter.TableOfContentsProvider).TableOfContents().ToHTML(2, 3)
|
||||||
c.Assert(got, qt.Equals, `<nav id="TableOfContents">
|
c.Assert(got, qt.Equals, `<nav id="TableOfContents">
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#first-h2">First h2</a>
|
<li><a href="#first-h2---now-with-typography">First h2—now with typography!</a>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#h3">H3</a></li>
|
<li><a href="#h3">H3</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
Loading…
Reference in a new issue