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

Incorrect syntax highlighting on Markdown #1633

Open
mtj0928 opened this issue May 8, 2024 · 3 comments
Open

Incorrect syntax highlighting on Markdown #1633

mtj0928 opened this issue May 8, 2024 · 3 comments
Labels
better to fix unwanted behaviors better to fix syntax highlight issues related to syntax highlighting

Comments

@mtj0928
Copy link

mtj0928 commented May 8, 2024

Description

There is an incorrect syntax highlighting on a case where a code block and inline code are used at the same time.
The text is highlighted as code incorrectly, and the inline code is not highlighted.

coteditor-incorrect-syntax

To Reproduce

  1. Make a new file.
  2. Select Markdown as a syntax.
  3. Paste the text to the file.
```
code
```
text
`incline code` 

Expected behavior

The text should not be highlighted and inline code should be highlighted as code.

CotEditor version

4.8.2

macOS version

14.4.1

Additional context

No response

@mtj0928 mtj0928 added the potential bug issues not yet tested label May 8, 2024
@mtj0928 mtj0928 changed the title Incorrect syntax highlighting on a case where a code block and inline code are used at the same time Incorrect syntax highlighting on Markdown May 8, 2024
@1024jp
Copy link
Member

1024jp commented May 10, 2024

Humm, thank you for the feedback.
But this is one of the difficult ones with the current parse implementation...
Let me think.

@1024jp 1024jp added syntax highlight issues related to syntax highlighting better to fix unwanted behaviors better to fix and removed potential bug issues not yet tested labels May 10, 2024
@herry23xet
Copy link

@mtj0928 What style do you use?
It looks really nice!

@OrkWard
Copy link

OrkWard commented Aug 24, 2024

Built-in syntax highlighter for markdown allow many wired things I've never use, say allow double ` for inline code.

I don't know where does these come from, and just defining a simpler highlight rule set for my own use. For example, don't allow any newline for inline code blocks, more strict rules for simple Regex.

Anyway, robust highlight is just an impossible task for Regex, even for languages with such a seemingly straightforward syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
better to fix unwanted behaviors better to fix syntax highlight issues related to syntax highlighting
Development

No branches or pull requests

4 participants