@codemirror/lang-html
Advanced tools
Comparing version 6.4.2 to 6.4.3
@@ -0,1 +1,7 @@ | ||
## 6.4.3 (2023-03-27) | ||
### Bug fixes | ||
Fix a bug that could cause some nested language regions to be parsed multiple times. | ||
## 6.4.2 (2023-02-10) | ||
@@ -2,0 +8,0 @@ |
@@ -64,2 +64,9 @@ import * as _codemirror_state from '@codemirror/state'; | ||
*/ | ||
declare const htmlPlain: LRLanguage; | ||
/** | ||
A language provider based on the [Lezer HTML | ||
parser](https://github.com/lezer-parser/html), extended with the | ||
JavaScript and CSS parsers to parse the content of `<script>` and | ||
`<style>` tags. | ||
*/ | ||
declare const htmlLanguage: LRLanguage; | ||
@@ -111,2 +118,2 @@ /** | ||
export { TagSpec, autoCloseTags, html, htmlCompletionSource, htmlCompletionSourceWith, htmlLanguage }; | ||
export { TagSpec, autoCloseTags, html, htmlCompletionSource, htmlCompletionSourceWith, htmlLanguage, htmlPlain }; |
@@ -531,3 +531,3 @@ import { parser, configureNesting } from '@lezer/html'; | ||
*/ | ||
const htmlLanguage = /*@__PURE__*/LRLanguage.define({ | ||
const htmlPlain = /*@__PURE__*/LRLanguage.define({ | ||
name: "html", | ||
@@ -572,4 +572,3 @@ parser: /*@__PURE__*/parser.configure({ | ||
}) | ||
], | ||
wrap: /*@__PURE__*/configureNesting(defaultNesting, defaultAttrs) | ||
] | ||
}), | ||
@@ -583,2 +582,11 @@ languageData: { | ||
/** | ||
A language provider based on the [Lezer HTML | ||
parser](https://github.com/lezer-parser/html), extended with the | ||
JavaScript and CSS parsers to parse the content of `<script>` and | ||
`<style>` tags. | ||
*/ | ||
const htmlLanguage = /*@__PURE__*/htmlPlain.configure({ | ||
wrap: /*@__PURE__*/configureNesting(defaultNesting, defaultAttrs) | ||
}); | ||
/** | ||
Language support for HTML, including | ||
@@ -597,3 +605,3 @@ [`htmlCompletion`](https://codemirror.net/6/docs/ref/#lang-html.htmlCompletion) and JavaScript and | ||
wrap = configureNesting((config.nestedLanguages || []).concat(defaultNesting), (config.nestedAttributes || []).concat(defaultAttrs)); | ||
let lang = wrap || dialect ? htmlLanguage.configure({ dialect, wrap }) : htmlLanguage; | ||
let lang = wrap ? htmlPlain.configure({ wrap, dialect }) : dialect ? htmlLanguage.configure({ dialect }) : htmlLanguage; | ||
return new LanguageSupport(lang, [ | ||
@@ -649,2 +657,2 @@ htmlLanguage.data.of({ autocomplete: htmlCompletionSourceWith(config) }), | ||
export { autoCloseTags, html, htmlCompletionSource, htmlCompletionSourceWith, htmlLanguage }; | ||
export { autoCloseTags, html, htmlCompletionSource, htmlCompletionSourceWith, htmlLanguage, htmlPlain }; |
{ | ||
"name": "@codemirror/lang-html", | ||
"version": "6.4.2", | ||
"version": "6.4.3", | ||
"description": "HTML language support for the CodeMirror code editor", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -5,10 +5,10 @@ <!-- NOTE: README.md is generated from src/README.md --> | ||
[ [**WEBSITE**](https://codemirror.net/6/) | [**ISSUES**](https://github.com/codemirror/dev/issues) | [**FORUM**](https://discuss.codemirror.net/c/next/) | [**CHANGELOG**](https://github.com/codemirror/lang-html/blob/main/CHANGELOG.md) ] | ||
[ [**WEBSITE**](https://codemirror.net/) | [**ISSUES**](https://github.com/codemirror/dev/issues) | [**FORUM**](https://discuss.codemirror.net/c/next/) | [**CHANGELOG**](https://github.com/codemirror/lang-html/blob/main/CHANGELOG.md) ] | ||
This package implements HTML language support for the | ||
[CodeMirror](https://codemirror.net/6/) code editor. | ||
[CodeMirror](https://codemirror.net/) code editor. | ||
The [project page](https://codemirror.net/6/) has more information, a | ||
number of [examples](https://codemirror.net/6/examples/) and the | ||
[documentation](https://codemirror.net/6/docs/). | ||
The [project page](https://codemirror.net/) has more information, a | ||
number of [examples](https://codemirror.net/examples/) and the | ||
[documentation](https://codemirror.net/docs/). | ||
@@ -56,8 +56,8 @@ This code is released under an | ||
</dd><dt id="user-content-html^config.nestedlanguages"> | ||
<code><strong><a href="#user-content-html^config.nestedlanguages">nestedLanguages</a></strong>⁠?: {tag: "script" | "style" | "textarea", attrs⁠?: fn(<a id="user-content-html^config.nestedlanguages.attrs^attrs" href="#user-content-html^config.nestedlanguages.attrs^attrs">attrs</a>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a><<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>>) → <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a>, parser: <a href="https://lezer.codemirror.net/docs/ref/#common.Parser">Parser</a>}[]</code></dt> | ||
<code><strong><a href="#user-content-html^config.nestedlanguages">nestedLanguages</a></strong>⁠?: {tag: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>, attrs⁠?: fn(<a id="user-content-html^config.nestedlanguages.attrs^attrs" href="#user-content-html^config.nestedlanguages.attrs^attrs">attrs</a>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a><<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>>) → <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a>, parser: <a href="https://lezer.codemirror.net/docs/ref/#common.Parser">Parser</a>}[]</code></dt> | ||
<dd><p>Register additional languages to parse the content of script, | ||
style, or textarea tags. If given, <code>attrs</code> should be a function | ||
that, given an object representing the tag's attributes, returns | ||
<code>true</code> if this language applies.</p> | ||
<dd><p>Register additional languages to parse the content of specific | ||
tags. If given, <code>attrs</code> should be a function that, given an | ||
object representing the tag's attributes, returns <code>true</code> if this | ||
language applies.</p> | ||
</dd><dt id="user-content-html^config.nestedattributes"> | ||
@@ -95,2 +95,6 @@ <code><strong><a href="#user-content-html^config.nestedattributes">nestedAttributes</a></strong>⁠?: {name: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>, tagName⁠?: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>, parser: <a href="https://lezer.codemirror.net/docs/ref/#common.Parser">Parser</a>}[]</code></dt> | ||
attributes, or a list of strings for suggested attribute values.</p> | ||
</dd><dt id="user-content-tagspec.globalattrs"> | ||
<code><strong><a href="#user-content-tagspec.globalattrs">globalAttrs</a></strong>⁠?: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></dt> | ||
<dd><p>When set to false, don't complete global attributes on this tag.</p> | ||
</dd><dt id="user-content-tagspec.children"> | ||
@@ -97,0 +101,0 @@ <code><strong><a href="#user-content-tagspec.children">children</a></strong>⁠?: readonly <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>[]</code></dt> |
Sorry, the diff of this file is not supported yet
72907
1421
129