daaain / daaain/Handlebars

Syntax highlighting glitch

Open
#105 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
303
Forks
48
PR merge metrics
No merged PRs in 30d

Description

Long lines can sometimes confuse the parser:

{{#if active}}<span>{{else}}<a {{#if id}}id="{{id}}"{{/if}} href="{{{url}}}">{{/if}}{{#if img}}<img class="desaturate" id="{{img.id}}" src="{{img.src}}" alt="{{img.alt}}" width="{{img.width}}" height="{{img.height}}" />{{/if}}{{name}}{{#if active}}</span>{{else}}</a>{{/if}}

The img closing bracket /> is where highlighting messes up and mistakenly highlights that and the rest of the line as HTML attribute color.

Whereas GitHub's own syntax highlighting correctly highlights the whole line!

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

Use the Handlebars template in the issue as the reproduction case and inspect the syntax-highlighting grammar or parser entry point that handles nested tags and long lines. Compare its output with GitHub's highlighting; done when the img closing bracket and the remainder of the line are no longer incorrectly colored as HTML attributes.

Written by the indexing model from the issue text.

Assessment

Tech stack
handlebars
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.