New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@codemirror/lang-html

Package Overview
Dependencies
Maintainers
2
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@codemirror/lang-html - npm Package Compare versions

Comparing version 0.19.2 to 0.19.3

8

CHANGELOG.md

@@ -0,1 +1,9 @@

## 0.19.3 (2021-09-23)
### New features
The package now exports a completion source function, rather than a prebuilt completion extension.
Use more specific highlighting tags for attribute names and values.
## 0.19.2 (2021-09-21)

@@ -2,0 +10,0 @@

13

dist/index.d.ts
import * as _codemirror_state from '@codemirror/state';
import { LRLanguage, LanguageSupport } from '@codemirror/language';
import { CompletionContext, CompletionResult } from '@codemirror/autocomplete';
/**
HTML tag completion. Opens and closes tags and attributes in a
context-aware way.
*/
declare function htmlCompletionSource(context: CompletionContext): CompletionResult | null;
/**
A language provider based on the [Lezer HTML

@@ -11,6 +18,2 @@ parser](https://github.com/lezer-parser/html), extended with the

declare const htmlLanguage: LRLanguage;
/**
HTML tag completion. Opens and closes tags and attributes in a
context-aware way.
*/
declare const htmlCompletion: _codemirror_state.Extension;

@@ -42,2 +45,2 @@ /**

export { autoCloseTags, html, htmlCompletion, htmlLanguage };
export { autoCloseTags, html, htmlCompletion, htmlCompletionSource, htmlLanguage };

@@ -449,3 +449,7 @@ import { parser, configureNesting } from '@lezer/html';

}
function completeHTML(context) {
/**
HTML tag completion. Opens and closes tags and attributes in a
context-aware way.
*/
function htmlCompletionSource(context) {
let { state, pos } = context, around = syntaxTree(state).resolveInner(pos), tree = around.resolve(pos, -1);

@@ -526,3 +530,2 @@ for (let scan = pos, before; around == tree && (before = tree.childBefore(scan));) {

/*@__PURE__*/styleTags({
AttributeValue: tags.string,
"Text RawText": tags.content,

@@ -532,4 +535,4 @@ "StartTag StartCloseTag SelfCloserEndTag EndTag SelfCloseEndTag": tags.angleBracket,

"MismatchedCloseTag/TagName": [tags.tagName, tags.invalid],
AttributeName: tags.propertyName,
UnquotedAttributeValue: tags.string,
AttributeName: tags.attributeName,
"AttributeValue UnquotedAttributeValue": tags.attributeValue,
Is: tags.definitionOperator,

@@ -557,11 +560,9 @@ "EntityReference CharacterReference": tags.character,

commentTokens: { block: { open: "<!--", close: "-->" } },
indentOnInput: /^\s*<\/\w+\W$/
indentOnInput: /^\s*<\/\w+\W$/,
wordChars: "-._"
}
});
// FIXME remove on next major version
const htmlCompletion = /*@__PURE__*/htmlLanguage.data.of({ autocomplete: htmlCompletionSource });
/**
HTML tag completion. Opens and closes tags and attributes in a
context-aware way.
*/
const htmlCompletion = /*@__PURE__*/htmlLanguage.data.of({ autocomplete: completeHTML });
/**
Language support for HTML, including

@@ -615,2 +616,2 @@ [`htmlCompletion`](https://codemirror.net/6/docs/ref/#lang-html.htmlCompletion) and JavaScript and

export { autoCloseTags, html, htmlCompletion, htmlLanguage };
export { autoCloseTags, html, htmlCompletion, htmlCompletionSource, htmlLanguage };
{
"name": "@codemirror/lang-html",
"version": "0.19.2",
"version": "0.19.3",
"description": "HTML language support for the CodeMirror code editor",

@@ -30,3 +30,3 @@ "scripts": {

"@codemirror/autocomplete": "^0.19.0",
"@codemirror/highlight": "^0.19.0",
"@codemirror/highlight": "^0.19.6",
"@codemirror/lang-css": "^0.19.0",

@@ -33,0 +33,0 @@ "@codemirror/lang-javascript": "^0.19.0",

@@ -23,5 +23,6 @@ <!-- NOTE: README.md is generated from src/README.md -->

## API Reference
<dl>
<dt id="user-content-html">
<code><strong><a href="#user-content-html">html</a></strong>() → <a href="https://codemirror.net/6/docs/ref#language.LanguageSupport">LanguageSupport</a></code></dt>
<code><strong><a href="#user-content-html">html</a></strong>(<a id="user-content-html^config" href="#user-content-html^config">config</a>&#8288;?: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a> = {}) → <a href="https://codemirror.net/6/docs/ref#language.LanguageSupport">LanguageSupport</a></code></dt>

@@ -31,8 +32,23 @@ <dd><p>Language support for HTML, including

CSS support extensions.</p>
</dd>
<dl><dt id="user-content-html^config">
<code><strong><a href="#user-content-html^config">config</a></strong></code></dt>
<dd><dl><dt id="user-content-html^config.matchclosingtags">
<code><strong><a href="#user-content-html^config.matchclosingtags">matchClosingTags</a></strong>&#8288;?: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></dt>
<dd><p>By default, the syntax tree will highlight mismatched closing
tags. Set this to <code>false</code> to turn that off (for example when you
expect to only be parsing a fragment of HTML text, not a full
document).</p>
</dd><dt id="user-content-html^config.autoclosetags">
<code><strong><a href="#user-content-html^config.autoclosetags">autoCloseTags</a></strong>&#8288;?: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></dt>
<dd><p>Determines whether <a href="#user-content-autoclosetags"><code>autoCloseTags</code></a>
is included in the support extensions. Defaults to true.</p>
</dd></dl></dd></dl></dd>
<dt id="user-content-htmllanguage">
<code><strong><a href="#user-content-htmllanguage">htmlLanguage</a></strong>: <a href="https://codemirror.net/6/docs/ref#language.LezerLanguage">LezerLanguage</a></code></dt>
<code><strong><a href="#user-content-htmllanguage">htmlLanguage</a></strong>: <a href="https://codemirror.net/6/docs/ref#language.LRLanguage">LRLanguage</a></code></dt>
<dd><p>A language provider based on the <a href="https://github.com/lezer-parser/html">Lezer HTML
parser</a>, wired up with the
parser</a>, extended with the
JavaScript and CSS parsers to parse the content of <code>&lt;script&gt;</code> and

@@ -47,2 +63,8 @@ <code>&lt;style&gt;</code> tags.</p>

</dd>
<dt id="user-content-autoclosetags">
<code><strong><a href="#user-content-autoclosetags">autoCloseTags</a></strong>: <a href="https://codemirror.net/6/docs/ref#state.Extension">Extension</a></code></dt>
<dd><p>Extension that will automatically insert close tags when a <code>&gt;</code> or
<code>/</code> is typed.</p>
</dd>
</dl>

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc