Skip to content

Commit

Permalink
fix(plugins/table): line map for table, table cell close tokens
Browse files Browse the repository at this point in the history
add line mapping to yfm_td_close and yfm_table_close tokens
  • Loading branch information
moki committed Jul 12, 2023
1 parent 69d9ebe commit 9600b7f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/transform/plugins/table/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ const yfmTable: MarkdownItPluginCb = (md) => {
state.eMarks[end.line] = oldEMark;

token = state.push('yfm_td_close', 'td', -1);
state.tokens[state.tokens.length - 1].map = [end.line, end.line + 1];
}

if (rowLength < maxRowLength) {
Expand All @@ -276,6 +277,7 @@ const yfmTable: MarkdownItPluginCb = (md) => {
token = state.push('yfm_tbody_close', 'tbody', -1);

token = state.push('yfm_table_close', 'table', -1);
state.tokens[state.tokens.length - 1].map = [endOfTable, endOfTable + 1];

state.lineMax = oldParentLineMax;
state.line = endOfTable;
Expand Down

0 comments on commit 9600b7f

Please sign in to comment.