highlightjs / highlightjs/highlight.js

Broaden `meta` with subscopes

Open
#3,265 0 comments 0 reactions 0 assignees View on GitHub
enhancement parser
Dominant language
JavaScript
Stars
25k
Forks
3.8k
Avg merge
11h 35m
Merged PRs (30d)
3

Description

**Is your request related to a specific problem you're having?**

See #3261. Generally speaking `meta` currently is used in many places for "this might be important, give it special emphasis" - it's a bit of a "catch all"... which is counter to our own policy of _semantically_ tagging content vs visually tagging it. Related: #2500 and the higher fidelity goals.

Some examples of how `meta` is currently used across grammars:

- `julia>` - REPL prompts
- `bob@localhost>` - shell prompts
- `` HTML doctypes
- `#include "blah.h"` - C preprocessor directives

**The solution you'd prefer / feature you'd like to see added...**

I haven't put a ton of thought into this yet, so I'll just put ideas into the following section.

**Any alternative solutions you considered...**

- Better scope(s) could be found for some of these
- the `meta` namespace could be expanded
- or both

Examples of expanding the namespace:

- `meta.prompt` - shell and repo prompts #3490
- `meta.preprecessor` - preprocessor directives

Not sure about HTML doctype... and honestly we'd need to take a look at ALL the grammars where we use meta and come up with an exhaustive list. If we're going to make a sweeping change here I want to do it eyes wide open and get it right the first time if at all possible.

**Additional context...**

Long-term I really like how TextMate grammar scopes use meta for "block scopes" that by themselves are typically unhighlighted but rather provide additional context for themes to more properly highlighting things WITHIN those scope. It seems nice, but I'm not sure how we get there from here without either coming up with another name entirely... or touching all the uses of meta at once and moving them to another top-level scope.

I mention this here because properly solving this likely requires touching/renaming `meta` everywhere to begin with so it's worth taking the time to think about if we're preparing to embark on a PR that is going to need to touch meta everywhere anyways.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.