aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler.rs (unfollow)
Commit message (Collapse)AuthorFilesLines
2022-09-19Add support for parsing MDX ESM, expressionsLibravatar Titus Wormer1-1/+2
This commit adds support for hooks that lets a user integrate another parser with `micromark-rs`, to parse ESM and expressions according to a particular grammar (such as a programming language, typically JavaScript). For an example integrating with SWC, see `tests/test_utils/mod.rs`. The integration occurs with two functions passed in `options`: `mdx_expression_parse` and `mdx_esm_parse`. The can signal back to micromark when they are successful, whether there is an error at the end (in which case micromark will try to parse more), or whether there is a syntax error (in which case micromark will crash).
2022-09-14Fix to prefer flow over definitions, setext headingsLibravatar Titus Wormer1-3/+3
An undocumented part of CommonMark is how to deal with things in definition labels or definition titles (which both can span multiple lines). Can flow (or containers?) interrupt them? They can according to the `cmark` reference parser, so this was implemented here. This adds a new `Content` content type, which houses zero or more definitions, and then zero-or-one paragraphs. Content can be followed by a setext heading underline, which either turns into a setext heading when the content ends in a paragraph, or turns into the start of the following paragraph when it is followed by content that starts with a paragraph, or turns into a stray paragraph.
2022-09-12Fix whitespace in GFM footnote definition identifiersLibravatar Titus Wormer1-4/+2
* Fix a crash on line endings in footnote definitions * Fix to match spaces and tabs in identifiers to `cmark-gfm` * Fix order of one attribute
2022-09-09Add mdx expression (flow, text)Libravatar Titus Wormer1-8/+13
2022-09-08Add support for mdx jsx (flow)Libravatar Titus Wormer1-0/+8
2022-09-08Add tests for mdx jsx (text)Libravatar Titus Wormer1-1/+5
2022-09-07Add support for recoverable syntax errorsLibravatar Titus Wormer1-1/+1
2022-09-05Add support for `mailto:`, `xmpp:` protocolsLibravatar Titus Wormer1-4/+34
2022-09-05Fix to implement GFM autolink literals exactlyLibravatar Titus Wormer1-4/+33
2022-09-01Add support for GFM tagfilterLibravatar Titus Wormer1-46/+43
2022-08-31Add support for GFM tablesLibravatar Titus Wormer1-3/+232
2022-08-26Add support for math (flow)Libravatar Titus Wormer1-35/+44
2022-08-26Add support for math (text)Libravatar Titus Wormer1-14/+19
2022-08-25Add support for GFM footnotesLibravatar Titus Wormer1-15/+301
2022-08-22Add support for GFM task list itemLibravatar Titus Wormer1-1/+25
2022-08-22Add support for GFM strikethroughLibravatar Titus Wormer1-1/+17
2022-08-19Refactor to move more things to `util/`Libravatar Titus Wormer1-1/+1
2022-08-18Add support for GFM autolink literalsLibravatar Titus Wormer1-35/+72
2022-08-16Add `no_std + alloc`Libravatar Titus Wormer1-1/+7
2022-08-16Add support for frontmatterLibravatar Titus Wormer1-0/+13
2022-08-15Refactor to proof docs, grammarsLibravatar Titus Wormer1-66/+89
2022-08-15Refactor to solve some clippy issuesLibravatar Titus Wormer1-1/+0
2022-08-12Refactor to improve docs of each functionLibravatar Titus Wormer1-1/+1
2022-08-11Refactor to move `space_or_tab_eol` to own fileLibravatar Titus Wormer1-61/+61
2022-08-11Refactor to move some code to `event.rs`Libravatar Titus Wormer1-105/+102
2022-08-11Add improved container exit injectionLibravatar Titus Wormer1-27/+42
2022-08-09Rewrite algorithm to not pass around boxed functionsLibravatar Titus Wormer1-21/+38
* Pass state names from an enum around instead of boxed functions * Refactor to simplify attempts a lot * Use a subtokenizer for the the `document` content type
2022-08-01Refactor to pass more `&str`s, work on more bytesLibravatar Titus Wormer1-90/+65
2022-08-01Remove unneeded field in compile contextLibravatar Titus Wormer1-39/+8
2022-07-29Refactor to improve statesLibravatar Titus Wormer1-236/+304
* Remove custom kind wrappers, use plain bytes instead * Remove `Into`s, use the explicit expected types instead * Refactor to use `slice.as_str` in most places * Remove unneeded unique check before adding a definition * Use a shared CDATA prefix in constants * Inline byte checks into matches * Pass bytes back from parser instead of whole parse state * Refactor to work more often on bytes * Rename custom `size` to `len`
2022-07-29Refactor to work on bytes (`u8`)Libravatar Titus Wormer1-21/+24
2022-07-28Refactor to work on `char`sLibravatar Titus Wormer1-95/+109
Previously, a custom char implementation was used. This was easier to work with, as sometimes “virtual” characters are injected, or characters are ignored. This replaces that with working on actual `char`s. In the hope of in the future working on `u8`s, even. This simplifies the state machine somewhat, as only `\n` is fed, regardless of whether it was a CRLF, CR, or LF. It also feeds `' '` instead of virtual spaces. The BOM, if present, is now available as a `ByteOrderMark` event.
2022-07-22Refactor to remove unneeded tuples in every statesLibravatar Titus Wormer1-3/+3
2022-07-20Refactor to improve allocation around stringsLibravatar Titus Wormer1-94/+80
2022-07-19Remove another unneeded `HashMap`Libravatar Titus Wormer1-137/+120
2022-07-18Change to improve `default_line_ending` apiLibravatar Titus Wormer1-3/+1
2022-07-18Refactor to move options to `lib/`Libravatar Titus Wormer1-160/+1
2022-07-18Remove unneeded tokenLibravatar Titus Wormer1-10/+8
2022-07-15Fix some final eol bugsLibravatar Titus Wormer1-0/+9
2022-07-15Fix compiling final eof after list itemsLibravatar Titus Wormer1-0/+2
2022-07-15Refactor to sort, document lists in tokenLibravatar Titus Wormer1-2/+1
2022-07-15Refactor to sort, document lists in compilerLibravatar Titus Wormer1-153/+146
2022-07-14Fix two more list bugsLibravatar Titus Wormer1-1/+1
2022-07-14Add support for container stateLibravatar Titus Wormer1-3/+18
* Fix to parse list item continuation based on how big the initial list item prefix was * Fix list items that start with blank lines
2022-07-14Fix a bunch of container thingsLibravatar Titus Wormer1-18/+37
* Fix a lot of container code * Fix to prevent code (indented) from interrupting a lazy container * Fix compiling when combining tight paragraphs, empty list items, and html * Fix list items starting w/ blank lines causing loose lists * Fix crash when looking for a previous blank line
2022-07-13Fix to close containers before several (blank) line endingsLibravatar Titus Wormer1-11/+12
2022-07-12Fix a lot of list thingsLibravatar Titus Wormer1-20/+71
* Add `ListItem`, `ListOrdered`, and `ListUnordered` tokens * Add support for multiline list items * Add support for tight lists * Fix bug where 10 digit long list item values worked * Fix skip bug when skipping over nested events
2022-07-12Add initial support for listsLibravatar Titus Wormer1-4/+78
2022-07-11Fix block quote bugsLibravatar Titus Wormer1-6/+9
2022-07-07Refactor to move token types to `token`Libravatar Titus Wormer1-136/+131