Commit Graph
73 Commits
Author SHA1 Message Date
Tony Brix ccd02296b0 docs: remove slugger (#2984) 2023-09-14 13:20:54 -06:00
Tony Brix 9a2a4ad61a fix: fix space removed after checkbox (#2971)
* fix: fix space removed after checkbox

* add loose test
2023-09-06 12:57:09 -06:00
Tony Brix 22ebdb2507 fix: remove deprecated options (#2936)
BREAKING CHANGE: deprecated options removed. See https://marked.js.org/using_advanced#options to see how to enable the removed options with extensions.
2023-09-02 22:02:24 -06:00
Tony Brix 65b6f146b6 add config option to bin/marked (#2937)
* add config option to bin/marked

* add tests

* add docs

* remove focused tests
2023-09-02 21:39:45 -06:00
Tony Brix b6ee877d58 fix: ignore async: false when async: true is set by an extension (#2920) 2023-08-19 16:58:32 -06:00
Tony Brix 63a839b8cb fix: change defaults for mangle and headerIds to false (#2890)
BREAKING CHANGE: change defaults for mangle and headerIds to false
2023-08-06 17:48:30 -06:00
Florian Dreier cb549065f1 fix: Migrate to Typescript (#2805)
BREAKING CHANGE: Migrate to Typescript
2023-07-29 00:31:34 -06:00
Tony BrixandSteven 353e13b479 feat: add Marked instance (#2831)
Co-authored-by: Steven <steven@ceriously.com>
2023-06-09 22:10:12 -05:00
Tony Brix fa21b9f60a feat: add block param to html renderer (#2768) 2023-05-01 23:31:40 -05:00
Tony Brix 62d3312b7a fix: deprecate options (#2766)
BREAKING CHANGE: deprecate options
2023-05-01 23:30:06 -05:00
Tony Brix 9b452bc7f1 feat: add preprocess and postprocess hooks (#2730) 2023-03-22 00:48:56 -05:00
Tony BrixandSteven 042dcc5431 fix: always return promise if async (#2728)
* fix: always return promise if async

* docs: await walktokens when async

* docs: walktokens async

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

* return rejected promise on error

---------

Co-authored-by: Steven <steven@ceriously.com>
2023-03-21 19:51:45 -05: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 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
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
Tony BrixandSteven 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
Phillip BurchandTony Brix 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
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
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 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 af14068b99 fix: fix node v12 (#2109) 2021-06-16 08:48:39 -05:00
Trevor BucknerandTony Brix 5be9d6d70e feat: Custom Tokenizer/Renderer extensions (#2043)
Co-authored-by: Tony Brix <tony@brix.ninja>
2021-06-15 18:22:00 -05:00
Tony Brix 1d973084ab fix: call walkTokens when calling marked with a callback(#2060) 2021-05-21 15:53:01 -05:00
Tony Brix 46cdfc1ece fix: fix items between lists (#1936) 2021-02-26 23:51:21 -06:00
Trevor Buckner f848e77039 fix: Join adjacent inlineText tokens (#1926) 2021-02-07 16:22:47 -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 c8a2b59d83 remove focused tests 2020-09-21 00:21:56 -05:00
Tony Brix baece60557 test marked.parseInline 2020-09-20 23:01:11 -05:00
flouc001 75b2646687 add sequence test 2020-07-15 08:16:03 +01:00
CallumandTony Brix 014fbcf43f add assertion to existing test
Co-authored-by: Tony Brix <tony@brix.ninja>
2020-07-15 08:03:31 +01:00
flouc001 710658cb61 use options param, update docs, update tests 2020-07-12 19:38:37 +01:00
flouc001 7c35a842a6 add dry run capabilities to default slugger 2020-07-11 09:24:46 +01:00
jun-sheaf fcfe15fba6 Fixed Example 272 2020-06-17 18:28:37 +02:00
jun-sheaf 5920cf9cf8 Updated rules and created tests. 2020-06-17 11:50:00 +02:00
Randolf C b4b909c00d Update Lexer-spec.js 2020-06-17 11:33:12 +02:00
Randolf C 242933e9e1 Update Lexer-spec.js 2020-06-17 11:32:45 +02:00
Randolf C 33d30247e9 Update Lexer-spec.js 2020-06-17 11:29:56 +02:00
Randolf C 1dccde3075 Update Lexer-spec.js 2020-06-17 11:28:52 +02:00
Randolf C c3a964d6c2 Update Lexer-spec.js 2020-06-17 11:28:11 +02:00
Tony Brix 0233262d76 fix async highlight sync 2020-05-21 10:26:48 -05:00
Tony Brix 267a176c9a add use walkTokens tests 2020-05-12 19:57:27 -05:00
Tony Brix a337c76ff6 add walkTokens option 2020-05-12 19:57:27 -05:00
Tony Brix db3b61bcc9 add tests 2020-05-12 19:57:27 -05:00
Tony Brix cb42b9003c add list_item type to list item token 2020-05-12 19:57:27 -05:00