micro-editor / micro-editor/micro

Markdown syntax highlighting handles nested emphasis incorrectly

Open
#2,383 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
29.6k
Forks
1.4k
Avg merge
2d 18h
Merged PRs (30d)
10

Description

Description of the problem or steps to reproduce

Start micro

Execute set filetype markdown

Enter the following in the buffer:

**nested *emphasis* works**
*nested **emphasis** works*
***even the simplest form is affected***

Observe that it's highlighted very incorrectly:

Bildschirmfoto von 2022-03-06 20-25-15

Note: Regular grammars are incapable of highlighting this correctly; this requires a CFG. I assume there might be further issues with MD highlighting because of this, but this is the only one I stumbled on during actual use so far.

Note that this is valid, unambiguous Markdown; Pandoc handles it correctly:

<p><strong>nested <em>emphasis</em> works</strong> <em>nested <strong>emphasis</strong> works</em> <strong><em>even the simplest form is affected</em></strong></p>

Specifications

Version: 2.0.10
Commit hash: b9763856
Compiled on August 07, 2021

GNOME Terminal.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the problem in micro 2.0.10 by setting the filetype to Markdown and entering the three nested-emphasis examples from the issue. Then locate the Markdown syntax-highlighting implementation and inspect how nested emphasis is handled. Done means the examples render with the expected emphasis highlighting without regressing ordinary Markdown highlighting.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, markdown
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.