Skip to content

Commit 8310c12

Browse files
fix:Add links heading to ToC (#63)
# Details Problem outlined in: #62 Link header is added to `toc` table, however this happens after the ToC is rendered so it is effectively ignored. Change rendering order so links are added before the ToC. Updated a unit test case to catch this.
1 parent a61a05f commit 8310c12

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

scripts/panvimdoc.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ Writer.Pandoc = function(doc, opts)
200200
DATE = doc.meta.date
201201
TITLE_DATE_PATTERN = doc.meta.titledatepattern
202202
local d = blocks(doc.blocks)
203-
local toc = renderToc()
204203
local notes = renderNotes()
204+
local toc = renderToc()
205205
local title = renderTitle()
206206
local footer = renderFooter()
207207
return { title, layout.blankline, toc, d, notes, layout.blankline, footer }

test/toc.jl

+15
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
# TLDR
88

9+
![caption](image.png)
10+
911
## Summary 1
1012
## Summary 2
1113

@@ -27,6 +29,7 @@ Table of Contents *test-table-of-contents*
2729
- Summary 2 |test-summary-2|
2830
3. Motivation |test-motivation|
2931
4. References |test-references|
32+
5. Links |test-links|
3033

3134
==============================================================================
3235
1. panvimdoc *test-panvimdoc*
@@ -49,6 +52,11 @@ SUMMARY 2 *test-summary-2*
4952
==============================================================================
5053
4. References *test-references*
5154

55+
==============================================================================
56+
5. Links *test-links*
57+
58+
1. *caption*: image.png
59+
5260
Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>
5361

5462
vim:tw=78:ts=8:noet:ft=help:norl:
@@ -60,6 +68,8 @@ vim:tw=78:ts=8:noet:ft=help:norl:
6068

6169
# TLDR
6270

71+
![caption](image.png)
72+
6373
## Summary 1
6474
## Summary 2
6575

@@ -93,6 +103,11 @@ SUMMARY 2 *test-summary-2*
93103
==============================================================================
94104
4. References *test-references*
95105

106+
==============================================================================
107+
5. Links *test-links*
108+
109+
1. *caption*: image.png
110+
96111
Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>
97112

98113
vim:tw=78:ts=8:noet:ft=help:norl:

0 commit comments

Comments
 (0)