mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-18 05:50:43 -07:00
docs: polish theme, playground, and reference pages
Improve readability of the docs site with updated light/dark tokens, shared code-block styling, and playground editors that follow system color scheme. Skip CookieHub on localhost, serve the browser bundle from theme source, and use backtick titles on filter/tag reference pages for consistent navigation. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: abs
|
||||
title: '`abs`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: append
|
||||
title: '`append`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: array_to_sentence_string
|
||||
title: '`array_to_sentence_string`'
|
||||
---
|
||||
|
||||
{% since %}v10.13.0{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: at_least
|
||||
title: '`at_least`'
|
||||
---
|
||||
|
||||
{% since %}v8.4.0{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: at_most
|
||||
title: '`at_most`'
|
||||
---
|
||||
|
||||
{% since %}v8.4.0{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: base64_decode
|
||||
title: '`base64_decode`'
|
||||
---
|
||||
|
||||
{% since %}v10.24.0{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: base64_encode
|
||||
title: '`base64_encode`'
|
||||
---
|
||||
|
||||
{% since %}v10.24.0{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: capitalize
|
||||
title: '`capitalize`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: ceil
|
||||
title: '`ceil`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: cgi_escape
|
||||
title: '`cgi_escape`'
|
||||
---
|
||||
|
||||
{% since %}v10.13.0{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: compact
|
||||
title: '`compact`'
|
||||
---
|
||||
|
||||
{% since %}v9.22.0{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: concat
|
||||
title: '`concat`'
|
||||
---
|
||||
|
||||
{% since %}v2.0.0{% endsince %}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
---
|
||||
title: date
|
||||
title: '`date`'
|
||||
---
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
Date filter is used to convert a timestamp into the specified format.
|
||||
The `date` filter is used to convert a timestamp into the specified format.
|
||||
|
||||
* LiquidJS tries to conform to Shopify/Liquid, which uses Ruby's core [Time#strftime(string)](https://www.ruby-doc.org/core/Time.html#method-i-strftime). There're differences with [Ruby's format flags](https://ruby-doc.org/core/strftime_formatting_rdoc.html):
|
||||
* `%Z` (since v10.11.1) is replaced by the passed-in timezone name from `LiquidOption` or in-place value (see TimeZone below). If passed-in timezone is an offset number instead of string, it'll behave like `%z`. If there's none passed-in timezone, it returns [the runtime's default time zone](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/resolvedOptions#timezone).
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: date_to_long_string
|
||||
title: '`date_to_long_string`'
|
||||
---
|
||||
{% since %}v10.13.0{% endsince %}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: date_to_rfc822
|
||||
title: '`date_to_rfc822`'
|
||||
---
|
||||
{% since %}v10.13.0{% endsince %}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: date_to_string
|
||||
title: '`date_to_string`'
|
||||
---
|
||||
{% since %}v10.13.0{% endsince %}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: date_to_xmlschema
|
||||
title: '`date_to_xmlschema`'
|
||||
---
|
||||
{% since %}v10.13.0{% endsince %}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: default
|
||||
title: '`default`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: divided_by
|
||||
title: '`divided_by`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: downcase
|
||||
title: '`downcase`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: escape
|
||||
title: '`escape`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: escape_once
|
||||
title: '`escape_once`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: find
|
||||
title: '`find`'
|
||||
---
|
||||
|
||||
{% since %}v10.11.0{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: find_exp
|
||||
title: '`find_exp`'
|
||||
---
|
||||
|
||||
{% since %}v10.11.0{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: find_index
|
||||
title: '`find_index`'
|
||||
---
|
||||
|
||||
{% since %}v10.21.0{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: find_index_exp
|
||||
title: '`find_index_exp`'
|
||||
---
|
||||
|
||||
{% since %}v10.21.0{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: first
|
||||
title: '`first`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: floor
|
||||
title: '`floor`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: group_by
|
||||
title: '`group_by`'
|
||||
---
|
||||
|
||||
{% since %}v10.11.0{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: group_by_exp
|
||||
title: '`group_by_exp`'
|
||||
---
|
||||
|
||||
{% since %}v10.11.0{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: has
|
||||
title: '`has`'
|
||||
---
|
||||
|
||||
{% since %}v10.21.0{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: has_exp
|
||||
title: '`has_exp`'
|
||||
---
|
||||
|
||||
{% since %}v10.21.0{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: hmac_sha256
|
||||
title: '`hmac_sha256`'
|
||||
---
|
||||
|
||||
{% since %}vNEXT{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: inspect
|
||||
title: '`inspect`'
|
||||
---
|
||||
|
||||
{% since %}v10.13.0{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: join
|
||||
title: '`join`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: json
|
||||
title: '`json`'
|
||||
---
|
||||
|
||||
{% since %}v9.10.0{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: jsonify
|
||||
title: '`jsonify`'
|
||||
---
|
||||
|
||||
{% since %}v10.13.0{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: last
|
||||
title: '`last`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: lstrip
|
||||
title: '`lstrip`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: map
|
||||
title: '`map`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: minus
|
||||
title: '`minus`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: modulo
|
||||
title: '`modulo`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: newline_to_br
|
||||
title: '`newline_to_br`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: normalize_whitespace
|
||||
title: '`normalize_whitespace`'
|
||||
---
|
||||
|
||||
{% since %}v10.13.0{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: number_of_words
|
||||
title: '`number_of_words`'
|
||||
---
|
||||
|
||||
{% since %}v10.13.0{% endsince %}
|
||||
|
||||
@@ -9,13 +9,13 @@ There's 40+ filters supported by LiquidJS. These filters can be categorized into
|
||||
|
||||
Categories | Filters
|
||||
--- | ---
|
||||
Math | plus, minus, modulo, times, floor, ceil, round, divided_by, abs, at_least, at_most
|
||||
String | append, prepend, capitalize, upcase, downcase, strip, lstrip, rstrip, strip_newlines, split, replace, replace_first, replace_last,remove, remove_first, remove_last, truncate, truncatewords, normalize_whitespace, number_of_words, array_to_sentence_string
|
||||
HTML/URI | escape, escape_once, url_encode, url_decode, strip_html, newline_to_br, xml_escape, cgi_escape, uri_escape, slugify
|
||||
Array | slice, map, sort, sort_natural, uniq, where, where_exp, group_by, group_by_exp, find, find_exp, first, last, join, reverse, concat, compact, size, push, pop, shift, unshift
|
||||
Date | date, date_to_xmlschema, date_to_rfc822, date_to_string, date_to_long_string
|
||||
Misc | default, json, jsonify, inspect, raw, to_integer
|
||||
Base64 | base64_encode, base64_decode
|
||||
Crypto | sha256, hmac_sha256
|
||||
Math | `plus`, `minus`, `modulo`, `times`, `floor`, `ceil`, `round`, `divided_by`, `abs`, `at_least`, `at_most`
|
||||
String | `append`, `prepend`, `capitalize`, `upcase`, `downcase`, `strip`, `lstrip`, `rstrip`, `strip_newlines`, `split`, `replace`, `replace_first`, `replace_last`,`remove`, `remove_first`, `remove_last`, `truncate`, `truncatewords`, `normalize_whitespace`, `number_of_words`, `array_to_sentence_string`
|
||||
HTML/URI | `escape`, `escape_once`, `url_encode`, `url_decode`, `strip_html`, `newline_to_br`, `xml_escape`, `cgi_escape`, `uri_escape`, `slugify`
|
||||
Array | `slice`, `map`, `sort`, `sort_natural`, `uniq`, `where`, `where_exp`, `group_by`, `group_by_exp`, `find`, `find_exp`, `first`, `last`, `join`, `reverse`, `concat`, `compact`, `size`, `push`, `pop`, `shift`, `unshift`
|
||||
Date | `date`, `date_to_xmlschema`, `date_to_rfc822`, `date_to_string`, `date_to_long_string`
|
||||
Misc | `default`, `json`, `jsonify`, `inspect`, `raw`, `to_integer`
|
||||
Base64 | `base64_encode`, `base64_decode`
|
||||
Crypto | `sha256`, `hmac_sha256`
|
||||
|
||||
[shopify/liquid]: https://github.com/Shopify/liquid
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: plus
|
||||
title: '`plus`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: pop
|
||||
title: '`pop`'
|
||||
---
|
||||
|
||||
{% since %}v10.11.0{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: prepend
|
||||
title: '`prepend`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: push
|
||||
title: '`push`'
|
||||
---
|
||||
|
||||
{% since %}v10.8.0{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: raw
|
||||
title: '`raw`'
|
||||
---
|
||||
|
||||
{% since %}v9.37.0{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: reject
|
||||
title: '`reject`'
|
||||
---
|
||||
|
||||
{% since %}v10.21.0{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: reject_exp
|
||||
title: '`reject_exp`'
|
||||
---
|
||||
|
||||
{% since %}v10.21.0{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: remove
|
||||
title: '`remove`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: remove_first
|
||||
title: '`remove_first`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: remove_last
|
||||
title: '`remove_last`'
|
||||
---
|
||||
|
||||
{% since %}v10.2.0{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: replace
|
||||
title: '`replace`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: replace_first
|
||||
title: '`replace_first`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: replace_last
|
||||
title: '`replace_last`'
|
||||
---
|
||||
|
||||
{% since %}v10.2.0{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: reverse
|
||||
title: '`reverse`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: round
|
||||
title: '`round`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: rstrip
|
||||
title: '`rstrip`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: sha256
|
||||
title: '`sha256`'
|
||||
---
|
||||
|
||||
{% since %}vNEXT{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: shift
|
||||
title: '`shift`'
|
||||
---
|
||||
|
||||
{% since %}v10.11.0{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: size
|
||||
title: '`size`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: slice
|
||||
title: '`slice`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: slugify
|
||||
title: '`slugify`'
|
||||
---
|
||||
|
||||
{% since %}v10.13.0{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: sort
|
||||
title: '`sort`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: sort_natural
|
||||
title: '`sort_natural`'
|
||||
---
|
||||
|
||||
{% since %}v8.4.0{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: split
|
||||
title: '`split`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: strip
|
||||
title: '`strip`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: strip_html
|
||||
title: '`strip_html`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: strip_newlines
|
||||
title: '`strip_newlines`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: sum
|
||||
title: '`sum`'
|
||||
---
|
||||
|
||||
{% since %}v10.10.0{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: times
|
||||
title: '`times`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: to_integer
|
||||
title: '`to_integer`'
|
||||
---
|
||||
|
||||
{% since %}v10.13.0{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: truncate
|
||||
title: '`truncate`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
@@ -36,7 +36,7 @@ Ground control, and so on
|
||||
|
||||
## No ellipsis
|
||||
|
||||
You can truncate to the exact number of characters specified by the first argument and avoid showing trailing characters by passing a blank string as the second argument:
|
||||
You can `truncate` to the exact number of characters specified by the first argument and avoid showing trailing characters by passing a blank string as the second argument:
|
||||
|
||||
Input
|
||||
```liquid
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: truncatewords
|
||||
title: '`truncatewords`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: uniq
|
||||
title: '`uniq`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: unshift
|
||||
title: '`unshift`'
|
||||
---
|
||||
|
||||
{% since %}v10.11.0{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: upcase
|
||||
title: '`upcase`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: uri_escape
|
||||
title: '`uri_escape`'
|
||||
---
|
||||
|
||||
{% since %}v10.13.0{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: url_decode
|
||||
title: '`url_decode`'
|
||||
---
|
||||
|
||||
{% since %}v6.1.0{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: url_encode
|
||||
title: '`url_encode`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: where
|
||||
title: '`where`'
|
||||
---
|
||||
|
||||
{% since %}v8.1.0{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: where_exp
|
||||
title: '`where_exp`'
|
||||
---
|
||||
|
||||
{% since %}v10.12.0{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: xml_escape
|
||||
title: '`xml_escape`'
|
||||
---
|
||||
|
||||
{% since %}v10.13.0{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: Assign
|
||||
title: '`assign`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: capture
|
||||
title: '`capture`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: case
|
||||
title: Case
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: cycle
|
||||
title: '`cycle`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: Decrement
|
||||
title: '`decrement`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: Include
|
||||
title: '`include`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
@@ -70,11 +70,11 @@ This way, you don't need to escape `"` in the filename expression.
|
||||
{% include prefix/{{name | append: ".html"}} %}
|
||||
```
|
||||
|
||||
## Jekyll include
|
||||
## Jekyll `include`
|
||||
|
||||
{% since %}v9.33.0{% endsince %}
|
||||
|
||||
[jekyllInclude][jekyllInclude] is used to enable Jekyll-like include syntax. Defaults to `false`, when set to `true`:
|
||||
[jekyllInclude][jekyllInclude] is used to enable Jekyll-like `include` syntax. Defaults to `false`, when set to `true`:
|
||||
|
||||
- Filename will be static: `dynamicPartials` now defaults to `false` (instead of `true`). And you can set `dynamicPartials` back to `true`.
|
||||
- Use `=` instead of `:` to separate parameter key-values.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: Increment
|
||||
title: '`increment`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: "# (inline comment)"
|
||||
title: '`#`'
|
||||
---
|
||||
|
||||
{% since %}v9.38.0{% endsince %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: Layout
|
||||
title: '`layout`'
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
@@ -31,12 +31,12 @@ If [extname][extname] option is set, the `.liquid` extension becomes optional:
|
||||
```
|
||||
|
||||
{% note info Scoping %}
|
||||
When a partial template is rendered by <code>layout</code>, its template have access for its caller's variables but not vice versa. Variables defined in layout will be popped out before control returning to its caller.
|
||||
When a partial template is rendered by the `layout` tag, its template have access for its caller's variables but not vice versa. Variables defined in `layout` will be popped out before control returning to its caller.
|
||||
{% endnote %}
|
||||
|
||||
## Multiple Blocks
|
||||
|
||||
The layout file can contain multiple blocks, each with a specified name. The following snippets yield same result as in the above example.
|
||||
The `layout` file can contain multiple blocks, each with a specified name. The following snippets yield same result as in the above example.
|
||||
|
||||
```liquid
|
||||
// default-layout.liquid
|
||||
@@ -53,7 +53,7 @@ The layout file can contain multiple blocks, each with a specified name. The fol
|
||||
|
||||
## Default Block Contents
|
||||
|
||||
In the above layout files, blocks has empty contents. But it's not necessarily be empty, in which case, the block contents in layout files will be used as default templates. The following snippets are also equivalent to the above examples:
|
||||
In the above `layout` files, blocks has empty contents. But it's not necessarily be empty, in which case, the block contents in `layout` files will be used as default templates. The following snippets are also equivalent to the above examples:
|
||||
|
||||
```liquid
|
||||
// default-layout.liquid
|
||||
@@ -68,7 +68,7 @@ In the above layout files, blocks has empty contents. But it's not necessarily b
|
||||
|
||||
## Passing Variables
|
||||
|
||||
Variables defined in current template can be passed to a the layout template by listing them as parameters on the `layout` tag:
|
||||
Variables defined in current template can be passed to a the `layout` template by listing them as parameters on the `layout` tag:
|
||||
|
||||
```liquid
|
||||
{% assign my_variable = 'apples' %}
|
||||
|
||||
@@ -9,10 +9,10 @@ There're a dozen of tags supported by LiquidJS, with all tags in [shopify/liquid
|
||||
|
||||
Category | Purpose | Tags
|
||||
--- | --- | ---
|
||||
Iteration | iterate over a collection | for, cycle, tablerow
|
||||
Control Flow | control the execution branch of template rendering | if, unless, elsif, else, case, when
|
||||
Variable | define and alter variables | assign, increment, decrement, capture, echo
|
||||
File | include another template or extend a layout template | render, include, layout
|
||||
Language | temporarily disable LiquidJS syntax | # (inline comment), raw, comment, liquid
|
||||
Iteration | iterate over a collection | `for`, `cycle`, `tablerow`
|
||||
Control Flow | control the execution branch of template rendering | `if`, `unless`, `elsif`, `else`, `case`, `when`
|
||||
Variable | define and alter variables | `assign`, `increment`, `decrement`, `capture`, `echo`
|
||||
File | include another template or extend a layout template | `render`, `include`, `layout`
|
||||
Language | temporarily disable LiquidJS syntax | `#`, `raw`, `comment`, `liquid`
|
||||
|
||||
[shopify/liquid]: https://github.com/Shopify/liquid
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: Render
|
||||
title: '`render`'
|
||||
---
|
||||
|
||||
{% since %}v9.2.0{% endsince %}
|
||||
@@ -32,7 +32,7 @@ When a partial template is rendered, the code inside it can't access its parent'
|
||||
|
||||
## Passing Variables
|
||||
|
||||
Variables defined in parent's scope can be passed to a the partial template by listing them as parameters on the render tag:
|
||||
Variables defined in parent's scope can be passed to a the partial template by listing them as parameters on the `render` tag:
|
||||
|
||||
```liquid
|
||||
{% assign my_variable = 'apples' %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: Table Row
|
||||
title: Tablerow
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
@@ -88,7 +88,7 @@ Output
|
||||
|
||||
### limit
|
||||
|
||||
Exits the tablerow after a specific index.
|
||||
Exits the `tablerow` after a specific index.
|
||||
|
||||
```liquid
|
||||
{% tablerow product in collection.products cols:2 limit:3 %}
|
||||
@@ -98,7 +98,7 @@ Exits the tablerow after a specific index.
|
||||
|
||||
### offset
|
||||
|
||||
Starts the tablerow after a specific index.
|
||||
Starts the `tablerow` after a specific index.
|
||||
|
||||
```liquid
|
||||
{% tablerow product in collection.products cols:2 offset:3 %}
|
||||
|
||||
Reference in New Issue
Block a user