Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@codemirror/lang-liquid

codemirror432.1kMIT6.2.2TypeScript support: included

Liquid template support for the CodeMirror code editor

editor, code, liquid

readme

@codemirror/lang-liquid NPM version

[ WEBSITE | ISSUES | FORUM | CHANGELOG ]

This package implements Liquid template support for the CodeMirror code editor.

The project page has more information, a number of examples and the documentation.

This code is released under an MIT license.

We aim to be an inclusive, welcoming community. To make that explicit, we have a code of conduct that applies to communication around the project.

API Reference

liquid(config⁠?: LiquidCompletionConfig & Object = {}) → LanguageSupport

Liquid template support.

liquidLanguage: LRLanguage

A language provider for Liquid templates.

type LiquidCompletionConfig

Configuration options to liquidCompletionSource.

tags⁠?: readonly Completion[]

Adds additional completions when completing a Liquid tag.

filters⁠?: readonly Completion[]

Add additional filter completions.

variables⁠?: readonly Completion[]

Add variable completions.

properties⁠?: fn(path: readonly string[], state: EditorState, context: CompletionContext) → readonly Completion[]

Provides completions for properties completed under the given path. For example, when completing user.address., path will be ["user", "address"].

liquidCompletionSource(config⁠?: LiquidCompletionConfig = {}) → fn(context: CompletionContext) → CompletionResult | null

Returns a completion source for liquid templates. Optionally takes a configuration that adds additional custom completions.

closePercentBrace: Extension

This extension will, when the user types a % between two matching braces, insert two percent signs instead and put the cursor between them.

changelog

6.2.2 (2024-11-14)

Bug fixes

Support filter syntax after assign directives.

6.2.1 (2024-02-02)

Bug fixes

Explicitly declare dependencies on @codemirror/state, /view, and /autocomplete.

6.2.0 (2024-01-03)

New features

The closePercentBrace extension (included in the default language support) will double percent signs typed between braces.

6.1.0 (2023-12-22)

New features

LiquidCompletionConfig.properties is now passed the completion context.

6.0.1 (2023-09-28)

Bug fixes

Remove an unneeded constraint that required the base language to be some form of HTML.

6.0.0 (2023-09-20)

Breaking changes

First numbered release.