A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/PrismJS/prism/issues/2948 below:

Easy embedded and recursive languages · Issue #2948 · PrismJS/prism · GitHub

Motivation
Right now, we use inside grammars for embedded languages.

This forces us to declare every embedded language as a dependency (required or optional). This increases the number of dependencies a lot. Optional embedded languages are the primary purpose of optional dependencies.

This idea comes from Highlight.JS' sublanguage, as pointed out here.

Description
Allow inside to be a language id (string). Prism.tokenize will then resolve the language at runtime.

This trivially solves the problem of recursive languages (example 1, 2). It also simplifies the dependencies because languages can be resolved at runtime.

Breaking Change
The only problem is that this is a breaking change. Some plugins change grammars (although the arguably should not). These plugins have to be changed to support the new grammar format.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4