kivikakk / comrak

CommonMark + GFM compatible Markdown parser and renderer
Other
1.17k stars 140 forks source link

Incorrect sourcepos for Setext headings #378

Closed digitalmoksha closed 5 months ago

digitalmoksha commented 5 months ago

It looks like the returned data-sourcepos for setext headings are off by one line.

header
---
this

gives

<h2 data-sourcepos="1:1-3:4">header</h2>
<p data-sourcepos="3:1-3:4">this</p>

I think it should be

<h2 data-sourcepos="1:1-2:3">header</h2>
<p data-sourcepos="3:1-3:4">this</p>

I'll try to spin up a PR in a couple days.

kivikakk commented 5 months ago

Wrong indeed; thanks so much!