Commit graph

32 commits

Author SHA1 Message Date
Simon Ser
8835a2656b renderer: fix panic on unregistered node kind
Renderers can ignore nodes they aren't interested in. However when a
renderer doesn't register the highest node kind traversing a Markdown
document results in the following panic:

    panic: runtime error: index out of range [1] with length 1

    goroutine 1 [running]:
    github.com/yuin/goldmark/renderer.(*renderer).Render.func2({0x9d8630, 0xc0001237a0}, 0x40?)
    	/home/simon/go/pkg/mod/github.com/yuin/goldmark@v1.4.11/renderer/renderer.go:164 +0xd9
    github.com/yuin/goldmark/ast.walkHelper({0x9d8630, 0xc0001237a0}, 0xc000521a48)
    	/home/simon/go/pkg/mod/github.com/yuin/goldmark@v1.4.11/ast/ast.go:492 +0x34
    github.com/yuin/goldmark/ast.Walk(...)
    	/home/simon/go/pkg/mod/github.com/yuin/goldmark@v1.4.11/ast/ast.go:487
    github.com/yuin/goldmark/renderer.(*renderer).Render(0xc0002d80a0?, {0x9d3b60?, 0xc0000744a0?}, {0xc0002f4580?, 0x281?, 0x2c0?}, {0x9d8630?, 0xc0001237a0?})
    	/home/simon/go/pkg/mod/github.com/yuin/goldmark@v1.4.11/renderer/renderer.go:161 +0x225
    github.com/yuin/goldmark.(*markdown).Convert(0xc0001e1d40, {0xc0002f4580, 0x281, 0x2c0}, {0x9d3b60, 0xc0000744a0}, {0x0, 0x0, 0x0})
    	/home/simon/go/pkg/mod/github.com/yuin/goldmark@v1.4.11/markdown.go:117 +0x10b
    main.renderMarkdown({0xc0002f42c0, 0x281})
    	/home/simon/src/hut/markdown.go:16 +0x97
    main.newListsListCommand.func1(0xc000270280?, {0xc778b8, 0x0, 0x0?})
    	/home/simon/src/hut/lists.go:109 +0x2ee
    github.com/spf13/cobra.(*Command).execute(0xc000270280, {0xc778b8, 0x0, 0x0})
    	/home/simon/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:860 +0x663
    github.com/spf13/cobra.(*Command).ExecuteC(0xc000242c80)
    	/home/simon/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:974 +0x3b4
    github.com/spf13/cobra.(*Command).Execute(...)
    	/home/simon/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:902
    github.com/spf13/cobra.(*Command).ExecuteContext(...)
    	/home/simon/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:895
    main.main()
    	/home/simon/src/hut/main.go:49 +0x30b

Make sure r.nodeRendererFuncs is large enough before trying to access it.
2022-04-04 15:23:03 +02:00
Yusuke Inuzuka
67340c7d10
Merge branch 'master' into add-global-attributes 2022-03-20 17:57:16 +09:00
Joe Mooring
8da81dfae2 Add global HTML attributes
Closes #291
2022-03-18 12:39:30 -07:00
Joe Mooring
3563ceb58e Remove obsolete global attributes
Closes #289
2022-03-18 12:01:33 -07:00
yuin
f6e93ffd8f Fix #274, Fix #275 2022-02-08 17:15:15 +09:00
yuin
beafde4b8f #248 - 6 2021-10-16 20:12:16 +09:00
yuin
bc90544cef #248 - 3 2021-10-16 18:56:49 +09:00
yuin
a8ed3c4205 Fix #245 - 9 2021-09-11 12:31:18 +09:00
yuin
7efc483c26 Fix #245 - 5 2021-09-11 11:45:00 +09:00
yuin
351308fb72 Fix #245 - 4 2021-09-11 11:20:50 +09:00
Joe Mooring
3fcf875f9f Add "type" to the list attribute filter
Closes #206
2021-03-31 12:47:01 -07:00
jsteuer
b91c802b8c html escape img alt attribute 2020-07-11 23:54:26 +02:00
pzl
8bdab9449a
documentation typo fixes 2020-02-14 22:03:49 -05:00
zzwx
224bf7d721 Additional attributes render with comments 2019-12-24 19:37:21 -05:00
yuin
7d8bee11ca Closes #33 : Now NodeRenderers render attributes 2019-12-08 18:53:01 +09:00
Yusuke Inuzuka
a47a029d55
Fix typo 2019-12-06 18:23:52 +09:00
Cameron Moore
3dc5ebdb17 Fix golint issues 2019-11-29 13:31:28 -06:00
Yusuke Inuzuka
667a2920f2 Change attribute parsing strategy 2019-08-28 20:29:23 +09:00
Liang Ding
6f6884271d
✏️ Fix typos 2019-08-07 18:15:09 +08:00
yuin
883918a85c Fix bugs found in fuzzing 2019-07-18 18:01:01 +09:00
yuin
05645dd3c4 Add String node 2019-05-30 16:07:04 +09:00
yuin
2ddc99baff Add extension tests, Fix bugs in extensions 2019-05-16 19:46:36 +09:00
yuin
1963434c50 Fix some vet errors, Improve attributes on ATXHeadings 2019-05-16 12:37:49 +09:00
yuin
d9164d2556 Rename options names 2019-05-06 01:14:17 +09:00
yuin
28b28e34bb Add Typographer extension 2019-05-06 00:53:22 +09:00
yuin
08a89f162a Refactoring 2019-05-05 15:08:50 +09:00
yuin
785421acb4 Add WithAttribute 2019-05-05 13:42:39 +09:00
yuin
45222d6b03 Refactoring 2019-05-04 19:27:13 +09:00
yuin
d4d7acb277 Add a definition list extension, some refactoring 2019-05-02 22:22:05 +09:00
yuin
987f65f813 Performance optimizations 2019-05-01 20:32:41 +09:00
yuin
77aabc8f8e Add WithUnsafe option 2019-04-27 15:30:16 +09:00
yuin
dd89404e04 first commit 2019-04-26 20:27:01 +09:00