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

Fix syn hi #82

Closed
nazmulidris opened this issue Jan 19, 2023 · 0 comments
Closed

Fix syn hi #82

nazmulidris opened this issue Jan 19, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@nazmulidris
Copy link
Member

nazmulidris commented Jan 19, 2023

Overview

  1. Build custom MD parser w/ custom extensions (metadata, smart list support). Get ideas from emacs org mode: https://youtu.be/cxoE2FhOIgI
  2. Build custom syntax highlighter for MD parser
  3. Use syntect as well in the MD parser & syntax highlighting in editor component

Motivation for this change

Currently in the editor component, syntax highlighting breaks when a new line is added. Here's an example.

**bold <- this appears bold
bold** <- this does not

I suspect the issue is the naive way in which we am doing syntax highlighting (1 line at a time). The helix editor uses the same syn hi engine and it handles the example above w/ no issues.

Also, lists are highlighted a single line at time, and it's not really possible to collect a smart list and its items that span multiple lines & multiple levels of indentation.

Thoughts on writing a custom MD parser using nom & ditching syntect

  • Potentially use nom in order to write a custom parser for MD. This has the advantage of being able to theme it intricately.
  • Leverage syntect as well (for code blocks that have lang specified). And fallback on the syntect highlighter. The implementation results in a nice interaction/animation almost where something will be highlighted using syntect & then overridden w/ the custom highlighter (when it has more specificity).
  • Also make color support smarter so that the R3BL syntect theme can fallback to ANSI colors on macOS (truecolor isn't supported)

Misc

This link has all the background info, videos, tutorials,
code, etc. on nom:

@nazmulidris nazmulidris added the bug Something isn't working label Jan 19, 2023
@nazmulidris nazmulidris modified the milestone: fix syn hi Jan 29, 2023
nazmulidris added a commit that referenced this issue Apr 20, 2023
Update tui/README.md as well for getting started content

Fixes #82
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant