637 Commits

Author SHA1 Message Date
Tony Brix
1bbda688f5
fix: fix paragraph continuation after block element (#2686) 2022-12-23 09:38:51 -06:00
Tony Brix
edc857c628
fix: use paragraph token in blockquote in list (#2671)
Fixes undefined
2022-12-07 01:45:09 -06:00
Tony Brix
697ac2a42e
fix: remove quotes at the end of gfm autolink (#2673)
Fixes undefined
2022-12-07 01:44:55 -06:00
Tony Brix
df4eb0e090
fix: loose list items are loose (#2672) 2022-12-07 01:44:35 -06:00
Tony Brix
73a7bf5cd9
fix: fix marked.use with multiple args (#2651)
Fixes undefined
2022-11-20 10:06:28 -06:00
Tony Brix
4aee878ac9
fix: fix multiline setext headings (#2655) 2022-11-20 10:06:04 -06:00
Tony Brix
b7eea9504b
fix: fix link reference definitions specs (#2654) 2022-11-20 10:05:52 -06:00
Tony Brix
36a2b639dc
fix: fix entity specs (#2652) 2022-11-20 10:05:26 -06:00
Tony Brix
44a2a2393c
fix: fix escape characters in links (#2628)
* fix: fix escape characters in links

* chore: remove escapes in def

* chore: fix lang replace on undefined
2022-11-04 19:40:34 -05:00
Richard Gibson
377823a6f5
fix: Support escapes within emphasis (#2627)
* fix: Support escapes within emphasis

...particularly right at the end.

Fixes #2280

* chore: realign comments with regexp alternatives

* test: Add HTML test for escapes within emphasis

* fix: Correct recognition and masking of escaped emphasis punctuation

* fix: Correct backslash fake-lookbehind
2022-11-01 21:03:58 -05:00
mayank singh tomar
f6ba2e39f7
fix: remove smartLists from docs and code (#2596)
* Removing smarLists 

for issue #2582

* Removing smartLists

for issue #2582

* removing smarLists

for issue #2582

* removing smartLists

for issue #2582

* removing samrtLists

for issue #2582

* removing smartLists

for issue #2582

* removing smartLists

for issue #2582
2022-09-30 20:32:10 -05:00
Tony Brix
994b2e6127
feat: add async option (#2474)
* fix: return values from walkTokens

* docs: add async docs

* test: add async test

* docs: add nav to async

* Update docs/USING_PRO.md

Co-authored-by: Steven <steven@ceriously.com>

* test: expect promise

* Update docs/USING_ADVANCED.md

Co-authored-by: Steven <steven@ceriously.com>

Co-authored-by: Steven <steven@ceriously.com>
2022-08-30 09:36:16 -05:00
Tony Brix
f1a9608201
fix: make second parameter optional on lexer.inline (#2552)
* fix: make second parameter optional on lexer.inline

* return tokens

* add test
2022-08-21 11:21:11 -05:00
Tony Brix
01c98d1c4e
fix: fix heading in list item (#2520)
fix: fix heading in code in list item
2022-07-11 10:12:57 -05:00
Kiyoka Nishiyama
15f3f157de
fix: Code and heading after list without blank line (#2483) 2022-06-12 22:15:06 -05:00
Tony Brix
81daa2ae47
fix: fix ref links inside table (#2471) 2022-05-17 09:28:47 -04:00
Kim, Jang-hwan
9c10b4d68f
fix: list item bullet without whitespace (#2431) 2022-05-02 01:12:30 -05:00
rossipedia
7d19665167
fix: only convert leading tabs to spaces (#1559) (#2434)
* fix: non leading-tabs in markdown content (#1559)

Only replaces tabs at the beginning of a block construct. Tabs in the
middle of the item are unaffected.

All tests passing. Tabs in both GFM and CommonMark at 100%

fixes #1559

* update new/html_comments.html to preserve tab

* combine redundant if condition

* add test for tab immediately after blockquote character
2022-04-10 19:37:04 -05:00
Zach Bialecki
ed66bf8abd
Add check in splitCells to prevent calling trim on undefined (#2372) 2022-01-26 22:07:01 -06:00
Tony Brix
6e1f9235dc
fix: fix blank line after table header (#2332) 2022-01-26 15:51:00 -06:00
Tony Brix
c4a3ccd344
Merge pull request from GHSA-rrrm-qjm4-v8hf
* fix: fix reflink redos

Co-authored-by: MakeNowJust <make.just.on@gmail.com>

* fix: fix def redos

Co-authored-by: MakeNowJust <make.just.on@gmail.com>

* fix block label for multiple slashes

Co-authored-by: MakeNowJust <make.just.on@gmail.com>
2022-01-12 19:53:48 -06:00
Phillip Burch
a9696e2898
fix: retain line breaks in tokens properly (#2341)
* Fix lexer and tokenizer to retain line breaks properly

* Add test for bug

* Check for line breaks not just spaces

* Fix lint

* Fix spacing in test

* clean up code

Co-authored-by: Tony Brix <tony@brix.ninja>
2022-01-06 09:31:58 -06:00
Chell
f82ea2cf1b
fix: spaces on a newline after a table (#2319)
* fix: rename inconsistent function

* fix: newline with 1~4 spaces below table

* fix: format html test

* fix: specify spaces only

* fix: specify spaces only

* fix: detect tab

* fix: detect tab

* fix: newline at the end of html
2021-12-18 18:21:22 -06:00
Trevor Buckner
346b162bb7
fix: Fix every third list item broken (#2318)
* Fix #2314
2021-12-09 18:58:17 -05:00
Trevor Buckner
e0005d8232
fix: speed up parsing long lists (#2302)
Co-authored-by: Tony Brix <tony@brix.ninja>
2021-12-01 21:18:07 -06:00
Emmet Jang
5714212afd
fix: table after paragraph without blank line (#2298)
* fix: gfm table requires leading empty line

* test(gfm/table): add some test cases

* revert changes to `gfm.0.29.json`

* test(gfm/table): add `table_following_text` testcase
2021-11-24 18:10:22 -06:00
MarkedJS bot
2110c6236f 🗜️ build [skip ci] 2021-11-12 21:39:24 +00:00
Ben McCann
4afb228d95
fix: Convert to ESM (#2227)
BREAKING CHANGE:

- Default export removed. Use `import { marked } from 'marked'` or `const { marked } = require('marked')` instead.
- `/lib/marked.js` removed. Use `/marked.min.js` in script tag instead.
- When using marked in a script tag use `marked.parse(...)` instead of `marked(...)`
2021-11-02 09:32:17 -05:00
Tony Brix
2da5885989
fix: walkTokens uses marked as this (#2251) 2021-10-24 00:03:59 -05:00
Trevor Buckner
7792adcfe6
Fix detection of orphaned emStrong delimiters (#2203) 2021-09-14 12:42:01 -05:00
Tony Brix
910f0f0356
fix: fix space at end of table line (#2201) 2021-09-08 15:20:45 -05:00
Tony Brix
21268abfba
fix: stop table at lines with only whitespace (#2188) 2021-08-24 21:23:53 -05:00
Tony Brix
e03b5c1f8d
fix: fix gfm urls after link (#2186) 2021-08-23 13:47:32 -05:00
Trevor Buckner
bc400ac789
fix: Refactor table tokens (#2166)
BREAKING CHANGE:

- `table` tokens `header` property changed to contain an array of objects for each header cell with `text` and `tokens` properties.
- `table` tokens `cells` property changed to `rows` and is an array of rows where each row contains an array of objects for each cell with `text` and `tokens` properties.

v2:

```json
{
  "type": "table",
  "align": [null, null],
  "raw": "| a | b |\n|---|---|\n| 1 | 2 |\n",
  "header": ["a", "b"],
  "cells": [["1", "2"]],
  "tokens": {
    "header": [
      [{ "type": "text", "raw": "a", "text": "a" }],
      [{ "type": "text", "raw": "b", "text": "b" }]
    ],
    "cells": [[
      [{ "type": "text", "raw": "1", "text": "1" }],
      [{ "type": "text", "raw": "2", "text": "2" }]
    ]]
  }
}
```

v3:

```json
{
  "type": "table",
  "align": [null, null],
  "raw": "| a | b |\n|---|---|\n| 1 | 2 |\n",
  "header": [
    {
      "text": "a",
      "tokens": [{ "type": "text", "raw": "a", "text": "a" }]
    },
    {
      "text": "b",
      "tokens": [{ "type": "text", "raw": "b", "text": "b" }]
    }
  ],
  "rows": [
    {
      "text": "1",
      "tokens": [{ "type": "text", "raw": "1", "text": "1" }]
    },
    {
      "text": "2",
      "tokens": [{ "type": "text", "raw": "2", "text": "2" }]
    }
  ]
}
```
2021-08-15 22:02:39 -05:00
Trevor Buckner
eb33d3b3a9
fix: Full Commonmark compliance for Lists (#2112) 2021-08-09 22:41:45 -05:00
Trevor Buckner
288f1cbe2f
Tokenizers lex their own child tokens (#2124)
BREAKING CHANGES:

- Tokenizers will create their own tokens with `this.lexer.inline(text, tokens)`. The `inline` function will queue the token creation until after all block tokens are rendered.
- `nptable` tokenizer is removed and merged with `table` tokenizer.
- Extensions tokenizer `this` object will include the `lexer` as a property. `this.inlineTokens` becomes `this.lexer.inline`.
- Extensions parser `this` object will include the `parser` as a property. `this.parseInline` becomes `this.parser.parseInline`.
- `tag` and `inlineText` tokenizer function signatures have changed.
2021-08-02 14:12:43 -05:00
Tony Brix
62d6a0e325
fix: update commonmark spec to v0.30 (#2113) 2021-06-25 15:14:09 -05:00
Tony Brix
af14068b99
fix: fix node v12 (#2109) 2021-06-16 08:48:39 -05:00
Trevor Buckner
5be9d6d70e
feat: Custom Tokenizer/Renderer extensions (#2043)
Co-authored-by: Tony Brix <tony@brix.ninja>
2021-06-15 18:22:00 -05:00
Trevor Buckner
825a9f82af
fix: em strong (#2075) 2021-06-01 15:26:35 -04:00
Tony Brix
6c9a8999dd
fix: fix autolink email after single space (#2073) 2021-05-27 11:15:32 -05:00
Tony Brix
1d973084ab
fix: call walkTokens when calling marked with a callback(#2060) 2021-05-21 15:53:01 -05:00
Michał Krassowski
6435ac9889
fix: Fix indented markdown in html (#2052)
Co-authored-by: Tony Brix <tony@brix.ninja>
2021-05-20 08:42:45 -05:00
Tony Brix
46cdfc1ece
fix: fix items between lists (#1936) 2021-02-26 23:51:21 -06:00
Trevor Buckner
7293251c43
fix: Total rework of Emphasis/Strong (#1864)
BREAKING CHANGE: `em` and `strong` tokenizers have been merged into one `emStrong` tokenizer
2021-02-07 16:25:01 -06:00
Trevor Buckner
f848e77039
fix: Join adjacent inlineText tokens (#1926) 2021-02-07 16:22:47 -06:00
Tony Brix
1e36afde55
fix: allow sublist to be single space in pedantic (#1924) 2021-02-03 13:46:25 -06:00
Tony Brix
53c79ee919
fix: leave whitespace only lines alone (#1889)
* fix: leave whitespace only lines alone

* test: add whitepace_lines test

* fix: render code with trailing new line
2021-01-26 08:20:13 -06:00
Tony Brix
70ee29c02b
fix: fix atx heading and make regex safe (#1853) 2020-12-10 10:28:58 -06:00
Tony Brix
656c3e4aba
fix: fix link with angle brackets around href (#1851) 2020-12-10 10:27:58 -06:00