pantsdown 1.4.2 → 1.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  # Pantsdown
4
4
 
5
+ <img src="https://raw.githubusercontent.com/wallpants/pantsdown/main/docs/github.svg" height="60px" align="right" />
6
+ <img src="https://raw.githubusercontent.com/wallpants/pantsdown/main/docs/markdown.svg" height="60px" align="right" />
7
+
5
8
  Pantsdown is a **Markdown** to **"GitHub HTML"** converter based on [Marked](https://github.com/markedjs/marked).
6
9
  Basically this is a non customizable version of Marked, optimized to render markdown similar to how GitHub does it plus
7
10
  some features developed specifically for [github-preview.nvim](https://github.com/wallpants/github-preview.nvim).
@@ -130,6 +133,7 @@ console.log(html);
130
133
  ## Roadmap
131
134
 
132
135
  - [x] Add id & anchors to headings
136
+ - [ ] Add sourcemap to list items
133
137
  - [ ] Add button to copy code in fences
134
138
  - [ ] [Mermaid](https://mermaid.js.org/) support
135
139
  - [ ] [Footnote](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#footnotes) support [Base](https://github.com/bent10/marked-extensions/tree/main/packages/footnote)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pantsdown",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "author": "wallpants",
5
5
  "description": "Markdown to 'GitHub HTML' parser",
6
6
  "license": "MIT",
package/src/parser.ts CHANGED
@@ -122,7 +122,12 @@ export class Parser {
122
122
  }
123
123
 
124
124
  itemBody += this.parse(item.tokens, loose);
125
- body += this.renderer.listitem(itemBody, task, Boolean(checked));
125
+ body += this.renderer.listitem(
126
+ itemBody,
127
+ task,
128
+ Boolean(checked),
129
+ token.sourceMap![0] + j,
130
+ );
126
131
  }
127
132
 
128
133
  const listClasses: string[] = [];
package/src/renderer.ts CHANGED
@@ -106,10 +106,12 @@ export class Renderer {
106
106
  );
107
107
  }
108
108
 
109
- listitem(text: string, task: boolean, _checked: boolean): string {
109
+ listitem(text: string, task: boolean, _checked: boolean, lineStart: number): string {
110
110
  const classes: string[] = [];
111
111
  if (task) classes.push("task-list-item");
112
- return `<li${renderHtmlClasses(classes)}>${text}</li>\n`;
112
+ return `<li${renderHtmlClasses(
113
+ classes,
114
+ )} line-start="${lineStart}" line-end="${lineStart}">${text}</li>\n`;
113
115
  }
114
116
 
115
117
  checkbox(checked: boolean, classes: string[] = []): string {