Tony Brix
6e1f9235dc
fix: fix blank line after table header ( #2332 )
2022-01-26 15:51:00 -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
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
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
Trevor Buckner
825a9f82af
fix: em strong ( #2075 )
2021-06-01 15:26:35 -04:00
sapristi
47e65cfb63
fix: actually add a type
property to the def
token ( #2002 )
...
Hmm I think I modified the wrong file (`lib/marked.js`) in the previous PR (see https://github.com/markedjs/marked/pull/2001 ) , this should be the right one ! Sorry for that.
2021-04-11 14:07:52 -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
John Hildenbiddle
4fdde20b9e
fix: Replace use of startsWith and endsWith with regex for IE11 ( #1877 )
...
fix #1876
2020-12-15 14:14:22 -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
Adrian Phinney
3942e894cf
fix: task lists not rendered when GFM is disabled ( #1825 )
...
* Fix #1823 - task lists are rendered even when GFM is disabled.
* end file with a new line
Co-authored-by: Tony Brix <tony@brix.ninja>
2020-11-19 08:30:04 -06:00
Tony Brix
d79f210aba
fix: no strikethrough on different number of tildes ( #1821 )
...
Possible Breaking Change: When using the inline.del rule the text is provided in capture group 2 instead of 1.
2020-11-14 20:03:39 -06:00
Tony Brix
5f9cafd49c
fix: list alignment ( #1810 )
...
* fix: fix list alignment
* test: add test
* test: update passing tests
* move regex to rules
* clean up code
* move item back to top
2020-11-04 15:23:04 -06:00
Tony Brix
6355ac2d6f
fix: fix indented code in list item ( #1762 )
2020-10-21 09:38:23 -05:00
Tony Brix
dddf9ae72c
Merge pull request #1686 from calculuschild/EmphasisFixes
2020-07-13 08:34:55 -05:00
Trevor Buckner
6b729ed8cd
Merge branch 'EmphasisFixes' of https://github.com/calculuschild/marked into EmphasisFixes
2020-07-09 19:37:22 -04:00
Trevor Buckner
e27e6f960f
Sorted strong and em into sub-objects
2020-07-09 19:35:22 -04:00
Trevor Buckner
ad720c1cba
Make emEnd const
...
Co-authored-by: Tony Brix <tony@brix.ninja>
2020-07-09 10:54:08 -04:00
Trevor Buckner
1fb141d275
Make strEnd const
...
Co-authored-by: Tony Brix <tony@brix.ninja>
2020-07-09 10:53:48 -04:00
Trevor Buckner
226bbe70b7
Lint
2020-07-08 17:01:42 -04:00
Trevor Buckner
cc778ade42
Removed redundancy in "startEM" check
2020-07-08 16:58:58 -04:00
Trevor Buckner
211b9f9a20
Removed Lookbehinds
...
Beginning and End delimiters for EM and Strong must be searched in a separate regex to work without lookbehinds. This invalidates the regex that skips over blocks (code, html, etc.) that take precedence over EM or Strong blocks.
Getting around this means we must now mask not only reflinks, but all enclosed blocks which were previously just skipped over in the Regex.
Add one check for overlapping Strong block when testing EM, now passes Commonmark 390 and 471
2020-07-08 16:00:12 -04:00
Trevor Buckner
4e7902ec11
Gaaaah lint
2020-06-30 17:50:19 -04:00
Trevor Buckner
4db32dc180
Links are masked only once per inline string
2020-06-30 17:49:11 -04:00
Tony Brix
d233fd5806
mask reflinks
2020-06-20 10:25:48 -05:00
jun-sheaf
fcfe15fba6
Fixed Example 272
2020-06-17 18:28:37 +02:00
Randolf C
1f77fb0782
Update src/Tokenizer.js
...
Co-authored-by: Tony Brix <tony@brix.ninja>
2020-06-17 17:27:28 +02:00
Trevor Buckner
e926e0cbfe
Lint...
2020-06-17 11:08:11 -04:00
Trevor Buckner
335a6601d4
Added fixes to Strong
...
Fixes examples 391, 397, 399, 400, 401, 431, 443, 475, 476, 479, and 480
2020-06-17 11:06:25 -04:00
Trevor Buckner
4cbba074d6
Moved logic into Tokenizer. No longer injecting Reflinks
...
Reflinks are replaced with the string 'aaaa' of equal length to hide any asterisks or underscores that might have been inside, since these should not be included. Then, the resulting string is matched to the em regex. The positions of the captures are then used on the original string.
2020-06-17 00:41:06 -04:00
Trevor Buckner
556070bffc
Updated rules for underscore em
...
Now fixes three more cases
2020-06-12 16:29:25 -04:00
Trevor Buckner
bc17deddb6
Lint
2020-06-12 15:37:18 -04:00
Randolf C
7118e4de01
Update Tokenizer.js
2020-06-12 16:03:38 +02:00
Randolf C
94bc32e900
Update Tokenizer.js
2020-06-12 16:00:36 +02:00
Trevor Buckner
4e2ec90374
Now passes several more tests
...
Added a check for the previous character to the *em* Tokenizer. Needed to pass any tests where the em block starts with a punctuation character (e.g. commonmark example 368)
2020-05-29 16:25:46 -04:00
Tony Brix
48448cc24f
fix image links with escaped brackets
2020-05-19 15:58:33 -05:00
Tony Brix
cb42b9003c
add list_item type to list item token
2020-05-12 19:57:27 -05:00
Steven
0a57e47d11
Merge pull request #1652 from UziTech/codespan-newline
...
Codespan newline
2020-05-03 15:19:53 -04:00
Ivan Demidov
56bf2308bf
perf: throw error if raw undefined
2020-04-28 08:52:20 +03:00
Ivan Demidov
228f0a61ca
perf: get match indent to code
2020-04-27 09:17:48 +03:00