liquidjs
- Version 10.17.0
- Published
- 1.47 MB
- 1 dependency
- MIT license
Install
npm i liquidjs
yarn add liquidjs
pnpm add liquidjs
Overview
A simple, expressive and safe Shopify / Github Pages compatible template engine in pure JavaScript.
Index
Variables
Functions
Classes
Tokenizer
- advance()
- assert()
- end()
- error()
- file
- input
- match()
- matchTrie()
- N
- p
- peek()
- peekType()
- readEndrawOrRawContent()
- readExpression()
- readExpressionTokens()
- readFileNameTemplate()
- readFilter()
- readFilterArg()
- readFilteredValue()
- readFilters()
- readHash()
- readHashes()
- readHTMLToken()
- readIdentifier()
- readLiquidTagToken()
- readLiquidTagTokens()
- readLiteral()
- readNonEmptyIdentifier()
- readNumber()
- readOperator()
- readOutputToken()
- readQuoted()
- readRange()
- readScopeValue()
- readTagName()
- readTagToken()
- readTo()
- readToDelimiter()
- readTopLevelToken()
- readTopLevelTokens()
- readValue()
- readValueOrThrow()
- readWord()
- remaining()
- rmatch()
- skipBlank()
- snapshot()
Interfaces
LiquidOptions
- cache
- catchAllErrors
- dateFormat
- dynamicPartials
- extname
- fs
- globals
- greedy
- jekyllInclude
- jsTruthy
- keepOutputType
- keyValueSeparator
- layouts
- lenientIf
- locale
- memoryLimit
- operators
- orderedFilterParameters
- outputDelimiterLeft
- outputDelimiterRight
- outputEscape
- ownPropertyOnly
- parseLimit
- partials
- preserveTimezones
- relativeReference
- renderLimit
- root
- strictFilters
- strictVariables
- tagDelimiterLeft
- tagDelimiterRight
- templates
- timezoneOffset
- trimOutputLeft
- trimOutputRight
- trimTagLeft
- trimTagRight
Enums
Type Aliases
Namespaces
Variables
variable defaultOperators
const defaultOperators: Operators;
variable defaultOptions
const defaultOptions: NormalizedFullOptions;
variable filters
const filters: Record<string, FilterImplOptions>;
variable tags
const tags: Record<string, TagClass>;
variable version
const version: string;
Functions
function assert
assert: <T>( predicate: T | null | undefined, message?: string | (() => string)) => void;
function createTrie
createTrie: <T = any>(input: TrieInput<T>) => Trie<T>;
function evalQuotedToken
evalQuotedToken: (token: QuotedToken) => string;
function evalToken
evalToken: ( token: Token | undefined, ctx: Context, lenient?: boolean) => IterableIterator<unknown>;
function isFalsy
isFalsy: (val: any, ctx: Context) => boolean;
function isTruthy
isTruthy: (val: any, ctx: Context) => boolean;
function toPromise
toPromise: <T>( val: Generator<unknown, T, unknown> | Promise<T> | T) => Promise<T>;
function toValue
toValue: (value: any) => any;
function toValueSync
toValueSync: <T>(val: Generator<unknown, T, unknown> | T) => T;
Classes
class AssertionError
class AssertionError extends Error {}
constructor
constructor(message: string);
class AssignTag
class extends Tag {}
constructor
constructor(token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid);
method render
render: (ctx: Context) => Generator<unknown, void, unknown>;
class BlockTag
class extends Tag {}
constructor
constructor( token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser);
property block
block: string;
property templates
templates: Template[];
method render
render: (ctx: Context, emitter: Emitter) => Generator<any, void, unknown>;
class CaptureTag
class extends Tag {}
constructor
constructor( tagToken: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser);
property templates
templates: Template[];
property variable
variable: string;
method render
render: (ctx: Context) => Generator<unknown, void, string>;
class CaseTag
class extends Tag {}
constructor
constructor( tagToken: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser);
property branches
branches: { values: ValueToken[]; templates: Template[] }[];
property elseTemplates
elseTemplates: Template[];
property value
value: Value;
method render
render: (ctx: Context, emitter: Emitter) => Generator<unknown, void, unknown>;
class CommentTag
class extends Tag {}
constructor
constructor(tagToken: TagToken, remainTokens: TopLevelToken[], liquid: Liquid);
method render
render: () => void;
class Context
class Context {}
constructor
constructor( env?: {}, opts?: NormalizedFullOptions, renderOptions?: RenderOptions, { memoryLimit, renderLimit }?: { [key: string]: Limiter });
property environments
environments: Scope;
user passed in scope
{% increment %}
,{% decrement %}
changes this scope, whereas{% capture %}
,{% assign %}
only hide this scope
property globals
globals: Scope;
global scope used as fallback for missing variables
property memoryLimit
memoryLimit: Limiter;
property opts
opts: NormalizedFullOptions;
The normalized liquid options object
property ownPropertyOnly
ownPropertyOnly: boolean;
property renderLimit
renderLimit: Limiter;
property strictVariables
strictVariables: boolean;
Throw when accessing undefined variable?
property sync
sync: boolean;
method bottom
bottom: () => Scope;
method get
get: (paths: PropertyKey[]) => unknown;
Deprecated
use
_get()
orgetSync()
instead
method getAll
getAll: () => Scope;
method getFromScope
getFromScope: ( scope: unknown, paths: PropertyKey[] | string) => IterableIterator<unknown>;
Deprecated
use
_get()
instead
method getRegister
getRegister: (key: string) => any;
method getSync
getSync: (paths: PropertyKey[]) => unknown;
method pop
pop: () => Scope | undefined;
method push
push: (ctx: object) => number;
method restoreRegister
restoreRegister: (keyValues: [string, any][]) => void;
method saveRegister
saveRegister: (...keys: string[]) => [string, any][];
method setRegister
setRegister: (key: string, value: any) => any;
method spawn
spawn: (scope?: {}) => Context;
class ContinueTag
class extends Tag {}
method render
render: (ctx: Context, emitter: Emitter) => void;
class CycleTag
class extends Tag {}
constructor
constructor(token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid);
method render
render: (ctx: Context, emitter: Emitter) => Generator<unknown, unknown, unknown>;
class DecrementTag
class extends Tag {}
constructor
constructor(token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid);
method render
render: (context: Context, emitter: Emitter) => void;
class Drop
abstract class Drop {}
method liquidMethodMissing
liquidMethodMissing: (key: string | number) => Promise<any> | any;
class EchoTag
class extends Tag {}
constructor
constructor(token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid);
method render
render: (ctx: Context, emitter: Emitter) => Generator<unknown, void, unknown>;
class Expression
class Expression {}
constructor
constructor(tokens: IterableIterator<Token>);
method evaluate
evaluate: ( ctx: Context, lenient?: boolean) => Generator<unknown, unknown, unknown>;
method valid
valid: () => boolean;
class Filter
class Filter {}
constructor
constructor( name: string, options: FilterImplOptions, args: FilterArg[], liquid: Liquid);
property args
args: FilterArg[];
property name
name: string;
property raw
readonly raw: boolean;
method render
render: (value: any, context: Context) => IterableIterator<unknown>;
class ForTag
class extends Tag {}
constructor
constructor( token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser);
property collection
collection: ValueToken;
property elseTemplates
elseTemplates: Template[];
property hash
hash: Hash;
property templates
templates: Template[];
property variable
variable: string;
method render
render: ( ctx: Context, emitter: Emitter) => Generator<unknown, void | string, Template[]>;
class Hash
class Hash {}
Key-Value Pairs Representing Tag Arguments Example: For the markup
, foo:'bar', coo:2 reversed %}
, hash['foo'] === 'bar' hash['coo'] === 2 hash['reversed'] === undefined
constructor
constructor(markup: string, jekyllStyle?: string | boolean);
property hash
hash: HashValueTokens;
method render
render: (ctx: Context) => Generator<unknown, Record<string, any>, unknown>;
class IfTag
class extends Tag {}
constructor
constructor( tagToken: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser);
property branches
branches: { value: Value; templates: Template[] }[];
property elseTemplates
elseTemplates: Template[];
method render
render: (ctx: Context, emitter: Emitter) => Generator<unknown, void, string>;
class IncludeTag
class extends Tag {}
constructor
constructor( token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser);
method render
render: (ctx: Context, emitter: Emitter) => Generator<unknown, void, unknown>;
class IncrementTag
class extends Tag {}
constructor
constructor(token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid);
method render
render: (context: Context, emitter: Emitter) => void;
class InlineCommentTag
class extends Tag {}
constructor
constructor(tagToken: TagToken, remainTokens: TopLevelToken[], liquid: Liquid);
method render
render: () => void;
class LayoutTag
class extends Tag {}
constructor
constructor( token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser);
property args
args: Hash;
property file
file?: ParsedFileName;
property templates
templates: Template[];
method render
render: (ctx: Context, emitter: Emitter) => Generator<unknown, unknown, unknown>;
class Liquid
class Liquid {}
constructor
constructor(opts?: LiquidOptions);
property filters
readonly filters: Record<string, FilterImplOptions>;
property options
readonly options: NormalizedFullOptions;
property parser
readonly parser: Parser;
Deprecated
will be removed. In tags use
this.parser
instead
property renderer
readonly renderer: Render;
property tags
readonly tags: Record<string, TagClass>;
method evalValue
evalValue: (str: string, scope?: object | Context) => Promise<any>;
method evalValueSync
evalValueSync: (str: string, scope?: object | Context) => any;
method express
express: () => ( this: any, filePath: string, ctx: object, callback: (err: Error | null, rendered: string) => void) => void;
method parse
parse: (html: string, filepath?: string) => Template[];
method parseAndRender
parseAndRender: ( html: string, scope?: Context | object, renderOptions?: RenderOptions) => Promise<any>;
method parseAndRenderSync
parseAndRenderSync: ( html: string, scope?: Context | object, renderOptions?: RenderOptions) => any;
method parseFile
parseFile: (file: string, lookupType?: LookupType) => Promise<Template[]>;
method parseFileSync
parseFileSync: (file: string, lookupType?: LookupType) => Template[];
method plugin
plugin: (plugin: (this: Liquid, L: typeof Liquid) => void) => void;
method registerFilter
registerFilter: (name: string, filter: FilterImplOptions) => void;
method registerTag
registerTag: (name: string, tag: TagClass | TagImplOptions) => void;
method render
render: ( tpl: Template[], scope?: object, renderOptions?: RenderOptions) => Promise<any>;
method renderFile
renderFile: ( file: string, ctx?: Context | object, renderFileOptions?: RenderFileOptions) => Promise<any>;
method renderFileSync
renderFileSync: ( file: string, ctx?: Context | object, renderFileOptions?: RenderFileOptions) => any;
method renderFileToNodeStream
renderFileToNodeStream: ( file: string, scope?: object, renderOptions?: RenderOptions) => Promise<NodeJS.ReadableStream>;
method renderSync
renderSync: ( tpl: Template[], scope?: object, renderOptions?: RenderOptions) => any;
method renderToNodeStream
renderToNodeStream: ( tpl: Template[], scope?: object, renderOptions?: RenderOptions) => NodeJS.ReadableStream;
class LiquidError
abstract class LiquidError extends Error {}
constructor
constructor(err: string | Error, token: Token);
property context
context: string;
property originalError
originalError?: Error;
property token
token: Token;
method is
static is: (obj: unknown) => obj is LiquidError;
method update
protected update: () => void;
class LiquidTag
class extends Tag {}
constructor
constructor( token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser);
property templates
templates: Template[];
method render
render: (ctx: Context, emitter: Emitter) => Generator<unknown, void, unknown>;
class Output
class Output extends TemplateImpl<OutputToken> implements Template {}
constructor
constructor(token: OutputToken, liquid: Liquid);
property value
value: Value;
method render
render: (ctx: Context, emitter: Emitter) => IterableIterator<unknown>;
class ParseError
class ParseError extends LiquidError {}
constructor
constructor(err: Error, token: Token);
class ParseStream
class ParseStream<T extends Token = TopLevelToken> {}
constructor
constructor(tokens: T[], parseToken: ParseToken<T>);
method on
on: <T2 extends Template | T>( name: string, cb: (this: ParseStream, arg: T2) => void) => ParseStream<T>;
method start
start: () => this;
method stop
stop: () => this;
class RawTag
class extends Tag {}
constructor
constructor(tagToken: TagToken, remainTokens: TopLevelToken[], liquid: Liquid);
method render
render: () => string;
class RenderError
class RenderError extends LiquidError {}
constructor
constructor(err: Error, tpl: Template);
method is
static is: (obj: any) => obj is RenderError;
class RenderTag
class extends Tag {}
constructor
constructor( token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser);
method render
render: (ctx: Context, emitter: Emitter) => Generator<unknown, void, unknown>;
class TablerowTag
class extends Tag {}
constructor
constructor( tagToken: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser);
property args
args: Hash;
property collection
collection: ValueToken;
property templates
templates: Template[];
property variable
variable: string;
method render
render: (ctx: Context, emitter: Emitter) => Generator<unknown, void, unknown>;
class Tag
abstract class Tag extends TemplateImpl<TagToken> implements Template {}
constructor
constructor(token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid);
property liquid
liquid: Liquid;
property name
name: string;
property tokenizer
protected tokenizer: Tokenizer;
method render
abstract render: (ctx: Context, emitter: Emitter) => TagRenderReturn;
class TagToken
class TagToken extends DelimitedToken {}
constructor
constructor( input: string, begin: number, end: number, options: NormalizedFullOptions, file?: string);
property args
readonly args: string;
property name
name: string;
property tokenizer
tokenizer: Tokenizer;
class Token
abstract class Token {}
constructor
constructor( kind: TokenKind, input: string, begin: number, end: number, file?: string);
property begin
begin: number;
property end
end: number;
property file
file?: string;
property input
input: string;
property kind
kind: TokenKind;
method getPosition
getPosition: () => number[];
method getText
getText: () => string;
method size
size: () => number;
class TokenizationError
class TokenizationError extends LiquidError {}
constructor
constructor(message: string, token: Token);
class Tokenizer
class Tokenizer {}
constructor
constructor( input: string, operators?: Operators, file?: string, range?: [number, number]);
property file
file?: string;
property input
input: string;
property N
N: number;
property p
p: number;
method advance
advance: (step?: number) => void;
method assert
assert: (pred: unknown, msg: string | (() => string), pos?: number) => void;
method end
end: () => boolean;
method error
error: (msg: string, pos?: number) => TokenizationError;
method match
match: (word: string) => boolean;
method matchTrie
matchTrie: <T>(trie: Trie<T>) => number;
method peek
peek: (n?: number) => string;
method peekType
peekType: (n?: number) => number;
method readEndrawOrRawContent
readEndrawOrRawContent: (options: NormalizedFullOptions) => HTMLToken | TagToken;
method readExpression
readExpression: () => Expression;
method readExpressionTokens
readExpressionTokens: () => IterableIterator<Token>;
method readFileNameTemplate
readFileNameTemplate: ( options: NormalizedFullOptions) => IterableIterator<TopLevelToken>;
method readFilter
readFilter: () => FilterToken | null;
method readFilterArg
readFilterArg: () => FilterArg | undefined;
method readFilteredValue
readFilteredValue: () => FilteredValueToken;
method readFilters
readFilters: () => FilterToken[];
method readHash
readHash: (jekyllStyle?: boolean | string) => HashToken | undefined;
method readHashes
readHashes: (jekyllStyle?: boolean | string) => HashToken[];
method readHTMLToken
readHTMLToken: (stopStrings: string[]) => HTMLToken;
method readIdentifier
readIdentifier: () => IdentifierToken;
method readLiquidTagToken
readLiquidTagToken: ( options: NormalizedFullOptions) => LiquidTagToken | undefined;
method readLiquidTagTokens
readLiquidTagTokens: (options?: NormalizedFullOptions) => LiquidTagToken[];
method readLiteral
readLiteral: () => LiteralToken | undefined;
method readNonEmptyIdentifier
readNonEmptyIdentifier: () => IdentifierToken | undefined;
method readNumber
readNumber: () => NumberToken | undefined;
method readOperator
readOperator: () => OperatorToken | undefined;
method readOutputToken
readOutputToken: (options?: NormalizedFullOptions) => OutputToken;
method readQuoted
readQuoted: () => QuotedToken | undefined;
method readRange
readRange: () => RangeToken | undefined;
method readScopeValue
readScopeValue: () => ValueToken | undefined;
method readTagName
readTagName: () => string;
method readTagToken
readTagToken: (options: NormalizedFullOptions) => TagToken;
method readTo
readTo: (end: string) => number;
method readToDelimiter
readToDelimiter: (delimiter: string, respectQuoted?: boolean) => number;
method readTopLevelToken
readTopLevelToken: (options: NormalizedFullOptions) => TopLevelToken;
method readTopLevelTokens
readTopLevelTokens: (options?: NormalizedFullOptions) => TopLevelToken[];
method readValue
readValue: () => ValueToken | undefined;
method readValueOrThrow
readValueOrThrow: () => ValueToken;
method readWord
readWord: () => IdentifierToken;
Deprecated
use #readIdentifier instead
method remaining
remaining: () => string;
method rmatch
rmatch: (pattern: string) => boolean;
method skipBlank
skipBlank: () => void;
method snapshot
snapshot: (begin?: number) => string;
class UndefinedVariableError
class UndefinedVariableError extends LiquidError {}
constructor
constructor(err: Error, token: Token);
class UnlessTag
class extends Tag {}
constructor
constructor( tagToken: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser);
property branches
branches: { value: Value; test: (val: any, ctx: Context) => boolean; templates: Template[];}[];
property elseTemplates
elseTemplates: Template[];
method render
render: (ctx: Context, emitter: Emitter) => Generator<unknown, unknown, unknown>;
class Value
class Value {}
constructor
constructor(input: string | FilteredValueToken, liquid: Liquid);
Parameter str
the value to be valuated, eg.: "foobar" | truncate: 3
property filters
readonly filters: Filter[];
property initial
readonly initial: Expression;
method value
value: (ctx: Context, lenient?: boolean) => Generator<unknown, unknown, unknown>;
Interfaces
interface Emitter
interface Emitter {}
interface FS
interface FS {}
property contains
contains?: (root: string, file: string) => boolean;
check if file is contained in
root
, always returntrue
by default. Warning: not setting this could expose path traversal vulnerabilities.
property dirname
dirname?: (file: string) => string;
required for relative path resolving
property exists
exists: (filepath: string) => Promise<boolean>;
check if a file exists asynchronously
property existsSync
existsSync: (filepath: string) => boolean;
check if a file exists synchronously
property fallback
fallback?: (file: string) => string | undefined;
fallback file for lookup failure
property readFile
readFile: (filepath: string) => Promise<string>;
read a file asynchronously
property readFileSync
readFileSync: (filepath: string) => string;
read a file synchronously
property resolve
resolve: (dir: string, file: string, ext: string) => string;
resolve a file against directory, for given
ext
option
property sep
sep?: string;
defaults to "/"
interface LiquidOptions
interface LiquidOptions {}
property cache
cache?: boolean | number | LiquidCache;
Whether or not to cache resolved templates. Defaults to
false
.
property catchAllErrors
catchAllErrors?: boolean;
Catch all errors instead of exit upon one. Please note that render errors won't be reached when parse fails.
property dateFormat
dateFormat?: string;
Default date format to use if the date filter doesn't include a format. Defaults to
%A, %B %-e, %Y at %-l:%M %P %z
.
property dynamicPartials
dynamicPartials?: boolean;
If set, treat the
filepath
parameter in{%include filepath %}
and{%layout filepath%}
as a variable, otherwise as a literal value. Defaults totrue
.
property extname
extname?: string;
Add a extname (if filepath doesn't include one) before template file lookup. Eg: setting to
".html"
will allow including file by basename. Defaults to""
.
property fs
fs?: FS;
fs
is used to override the default file-system module with a custom implementation.
property globals
globals?: object;
the global scope passed down to all partial and layout templates, i.e. templates included by
include
,layout
andrender
tags.
property greedy
greedy?: boolean;
Whether
trim*Left
/trim*Right
is greedy. When set totrue
, all consecutive blank characters including\n
will be trimmed regardless of line breaks. Defaults totrue
.
property jekyllInclude
jekyllInclude?: boolean;
Use jekyll style include, pass parameters to
include
variable of current scope. Defaults tofalse
.
property jsTruthy
jsTruthy?: boolean;
Use JavaScript Truthiness. Defaults to
false
.
property keepOutputType
keepOutputType?: boolean;
Whether or not to keep value type when writing the Output, not working for streamed rendering. Defaults to
false
.
property keyValueSeparator
keyValueSeparator?: string;
keyValue separator
property layouts
layouts?: string | string[];
A directory or an array of directories from where to resolve layout templates. If it's an array, the files are looked up in the order they occur in the array. Defaults to
root
property lenientIf
lenientIf?: boolean;
Modifies the behavior of
strictVariables
. If set, a single undefined variable will *not* cause an exception in the context of theif
/elsif
/unless
tag and thedefault
filter. Instead, it will evaluate tofalse
andnull
, respectively. Irrelevant ifstrictVariables
is not set. Defaults tofalse
. *
property locale
locale?: string;
Default locale, will be used by date filter. Defaults to system locale.
property memoryLimit
memoryLimit?: number;
For DoS handling, limit new objects creation, including array concat/join/strftime, etc. A typical PC can handle 1e9 (1G) memory without issue.
property operators
operators?: Operators;
An object of operators for conditional statements. Defaults to the regular Liquid operators.
property orderedFilterParameters
orderedFilterParameters?: boolean;
Respect parameter order when using filters like "for ... reversed limit", Defaults to
false
.
property outputDelimiterLeft
outputDelimiterLeft?: string;
The left delimiter for liquid outputs. *
property outputDelimiterRight
outputDelimiterRight?: string;
The right delimiter for liquid outputs. *
property outputEscape
outputEscape?: OutputEscapeOption;
Default escape filter applied to output values, when set, you'll have to add
| raw
for values don't need to be escaped. Defaults toundefined
.
property ownPropertyOnly
ownPropertyOnly?: boolean;
Hide scope variables from prototypes, useful when you're passing a not sanitized object into LiquidJS or need to hide prototypes from templates.
property parseLimit
parseLimit?: number;
For DoS handling, limit total length of templates parsed in one
parse()
call. A typical PC can handle 1e8 (100M) characters without issues.
property partials
partials?: string | string[];
A directory or an array of directories from where to resolve included templates. If it's an array, the files are looked up in the order they occur in the array. Defaults to
root
property preserveTimezones
preserveTimezones?: boolean;
Whether input strings to date filter preserve the given timezone *
property relativeReference
relativeReference?: boolean;
Allow refer to layouts/partials by relative pathname. To avoid arbitrary filesystem read, paths been referenced also need to be within corresponding root, partials, layouts. Defaults to
true
.
property renderLimit
renderLimit?: number;
For DoS handling, limit total time (in ms) for each
render()
call.
property root
root?: string | string[];
A directory or an array of directories from where to resolve layout and include templates, and the filename passed to
.renderFile()
. If it's an array, the files are looked up in the order they occur in the array. Defaults to["."]
property strictFilters
strictFilters?: boolean;
Whether or not to assert filter existence. If set to
false
, undefined filters will be skipped. Otherwise, undefined filters will cause an exception. Defaults tofalse
.
property strictVariables
strictVariables?: boolean;
Whether or not to assert variable existence. If set to
false
, undefined variables will be rendered as empty string. Otherwise, undefined variables will cause an exception. Defaults tofalse
.
property tagDelimiterLeft
tagDelimiterLeft?: string;
The left delimiter for liquid tags. *
property tagDelimiterRight
tagDelimiterRight?: string;
The right delimiter for liquid tags. *
property templates
templates?: { [key: string]: string;};
Render from in-memory
templates
mapping instead of file system. File system related options likefs
, 'root', andrelativeReference
will be ignored whentemplates
is specified.
property timezoneOffset
timezoneOffset?: number | string;
JavaScript timezone name or timezoneOffset for
date
filter, default to local time. That means if you're in Australia (UTC+10), it'll default to-600
orAustralia/Lindeman
property trimOutputLeft
trimOutputLeft?: boolean;
Similar to
trimOutputRight
, whereas the\n
is exclusive. Defaults tofalse
. See Whitespace Control for details.
property trimOutputRight
trimOutputRight?: boolean;
Strip blank characters (including
\t
, and\r
) from the right of values ({{ }}
) until\n
(inclusive). Defaults tofalse
.
property trimTagLeft
trimTagLeft?: boolean;
Similar to
trimTagRight
, whereas the\n
is exclusive. Defaults tofalse
. See Whitespace Control for details.
property trimTagRight
trimTagRight?: boolean;
Strip blank characters (including
\t
, and\r
) from the right of tags ({% %}
) until\n
(inclusive). Defaults tofalse
.
interface Template
interface Template {}
interface Trie
interface Trie<T> {}
index signature
[key: string]: Trie<T> | TrieLeafNode<T>;
Enums
enum TokenKind
enum TokenKind { Number = 1, Literal = 2, Tag = 4, Output = 8, HTML = 16, Filter = 32, Hash = 64, PropertyAccess = 128, Word = 256, Range = 512, Quoted = 1024, Operator = 2048, FilteredValue = 4096, Delimited = 12,}
member Delimited
Delimited = 12
member Filter
Filter = 32
member FilteredValue
FilteredValue = 4096
member Hash
Hash = 64
member HTML
HTML = 16
member Literal
Literal = 2
member Number
Number = 1
member Operator
Operator = 2048
member Output
Output = 8
member PropertyAccess
PropertyAccess = 128
member Quoted
Quoted = 1024
member Range
Range = 512
member Tag
Tag = 4
member Word
Word = 256
Type Aliases
type FilterImplOptions
type FilterImplOptions = FilterHandler | FilterOptions;
type Operators
type Operators = Record<string, OperatorHandler>;
type Scope
type Scope = ScopeObject | Drop;
type TopLevelToken
type TopLevelToken = TagToken | OutputToken | HTMLToken;
type ValueToken
type ValueToken = | RangeToken | LiteralToken | QuotedToken | PropertyAccessToken | NumberToken;
Namespaces
namespace TypeGuards
module 'dist/util/type-guards.d.ts' {}
function isDelimitedToken
isDelimitedToken: (val: any) => val is DelimitedToken;
function isHTMLToken
isHTMLToken: (val: any) => val is HTMLToken;
function isLiteralToken
isLiteralToken: (val: any) => val is LiteralToken;
function isNumberToken
isNumberToken: (val: any) => val is NumberToken;
function isOperatorToken
isOperatorToken: (val: any) => val is OperatorToken;
function isOutputToken
isOutputToken: (val: any) => val is OutputToken;
function isPropertyAccessToken
isPropertyAccessToken: (val: any) => val is PropertyAccessToken;
function isQuotedToken
isQuotedToken: (val: any) => val is QuotedToken;
function isRangeToken
isRangeToken: (val: any) => val is RangeToken;
function isTagToken
isTagToken: (val: any) => val is TagToken;
function isWordToken
isWordToken: (val: any) => val is IdentifierToken;
Package Files (54)
- dist/context/context.d.ts
- dist/context/scope.d.ts
- dist/drop/drop.d.ts
- dist/emitters/emitter.d.ts
- dist/filters/index.d.ts
- dist/fs/fs.d.ts
- dist/index.d.ts
- dist/liquid-options.d.ts
- dist/liquid.d.ts
- dist/parser/parse-stream.d.ts
- dist/parser/token-kind.d.ts
- dist/parser/tokenizer.d.ts
- dist/render/boolean.d.ts
- dist/render/expression.d.ts
- dist/render/operator.d.ts
- dist/tags/assign.d.ts
- dist/tags/block.d.ts
- dist/tags/break.d.ts
- dist/tags/capture.d.ts
- dist/tags/case.d.ts
- dist/tags/comment.d.ts
- dist/tags/continue.d.ts
- dist/tags/cycle.d.ts
- dist/tags/decrement.d.ts
- dist/tags/echo.d.ts
- dist/tags/for.d.ts
- dist/tags/if.d.ts
- dist/tags/include.d.ts
- dist/tags/increment.d.ts
- dist/tags/index.d.ts
- dist/tags/inline-comment.d.ts
- dist/tags/layout.d.ts
- dist/tags/liquid.d.ts
- dist/tags/raw.d.ts
- dist/tags/render.d.ts
- dist/tags/tablerow.d.ts
- dist/tags/unless.d.ts
- dist/template/filter-impl-options.d.ts
- dist/template/filter.d.ts
- dist/template/hash.d.ts
- dist/template/output.d.ts
- dist/template/tag.d.ts
- dist/template/template.d.ts
- dist/template/value.d.ts
- dist/tokens/tag-token.d.ts
- dist/tokens/token.d.ts
- dist/tokens/top-level-token.d.ts
- dist/tokens/value-token.d.ts
- dist/util/assert.d.ts
- dist/util/async.d.ts
- dist/util/error.d.ts
- dist/util/operator-trie.d.ts
- dist/util/type-guards.d.ts
- dist/util/underscore.d.ts
Dependencies (1)
Dev Dependencies (45)
- @commitlint/cli
- @commitlint/config-conventional
- @semantic-release/changelog
- @semantic-release/commit-analyzer
- @semantic-release/git
- @semantic-release/npm
- @semantic-release/release-notes-generator
- @types/benchmark
- @types/express
- @types/jest
- @types/jsdom
- @types/node
- @types/sinon
- @types/supertest
- @typescript-eslint/eslint-plugin
- @typescript-eslint/parser
- all-contributors-cli
- benchmark
- coveralls
- cross-env
- eslint
- eslint-config-standard
- eslint-plugin-deprecation
- eslint-plugin-import
- eslint-plugin-mocha
- eslint-plugin-node
- eslint-plugin-promise
- eslint-plugin-standard
- express
- husky
- jest
- jsdom
- rollup
- rollup-plugin-replace
- rollup-plugin-typescript2
- rollup-plugin-uglify
- rollup-plugin-version-injector
- semantic-release
- sinon
- supertest
- ts-jest
- tslib
- typedoc
- typedoc-plugin-missing-exports
- typescript
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/liquidjs
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/liquidjs)
- HTML<a href="https://www.jsdocs.io/package/liquidjs"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 5947 ms. - Missing or incorrect documentation? Open an issue for this package.