Skip to content

Enable CommonMark source line position information

Brett Walker requested to merge bw-enable-sourcepos into master

What does this MR do?

Enables the CommonMark data-sourcepos attribute to be added to the rendered HTML. This marks the line number and range in the markdown source of each html element. For example:

A simple tasklist

- [x] one
- [x] two

generates this

<p data-sourcepos="1:1-1:17" dir="auto">A simple tasklist</p>
<ul data-sourcepos="3:1-5:0" class="task-list" dir="auto">
  <li data-sourcepos="3:1-3:9" class="task-list-item enabled">
    <input type="checkbox" class="task-list-item-checkbox" checked=""> one
  </li>
  <li data-sourcepos="4:1-5:0" class="task-list-item enabled">
    <input type="checkbox" class="task-list-item-checkbox" checked=""> two
  </li>
</ul>

One benefit of this is to know when an item is clicked on, like a checkbox, which line in the markdown source it comes from.

What are the relevant issue numbers?

https://gitlab.com/gitlab-org/gitlab-ce/issues/55577
https://gitlab.com/gitlab-org/gitlab-ce/issues/19745

Does this MR meet the acceptance criteria?


Related EE MR: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/9083

Edited by Brett Walker

Merge request reports