Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace markdown-it with remark! #13

Merged
merged 28 commits into from
Jun 4, 2021

Conversation

benrbray
Copy link
Owner

@benrbray benrbray commented Jun 4, 2021

This pull request focuses on replacing the internal markdown-it parser with remark, which I chose for its emphasis on ASTs rather than a token stream representation of the input, making it much easier to build syntax extensions.

Replacing the markdown parser required a number of changes:

  • I wrote a few syntax extensions, including the npm package @benrbray/remark-cite, to cover some of the syntax used by Noteworthy which was not already built-in to remark.

  • I wrote tree transformations to convert from the mdast AST format into the prosemirror document format and back. Noteworthy syntax extensions can easily declare a new node transformation.

  • Workspace plugins (such as the xref plugin, which handles tags/citations) now operate on Markdown ASTs, rather than on ProseMirror documents.

  • To ensure the correctness of this and future changes, I wrote a number of test cases covering the markdown parser and the behavior of workspaces.

Resolves #2 .

…es and their corresponding AST representation ; temporarily disabled some syntax features
… step towards using mdast as the intermediate representation for documents
…yChild to catch similar missing-field bugs in the future
…s into one file ; create remark-concrete plugin for remembering source file syntax
…kable FSAL ; add test cases to ensure this and future changes don't break expected workspace behavior
@benrbray benrbray added the enhancement New feature or request label Jun 4, 2021
@benrbray benrbray added this to the Public Beta milestone Jun 4, 2021
@benrbray benrbray merged commit e99db05 into master Jun 4, 2021
@benrbray benrbray changed the title Replace markdown-it with remark 🎉 Replace markdown-it with remark! Jun 4, 2021
@benrbray benrbray deleted the feat/replace-markdown-it-with-remark branch June 4, 2021 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve Markdown Parser
1 participant