From 2790e8c339f57caa534296247efca4c89e2b9d3f Mon Sep 17 00:00:00 2001 From: Adam Hollett Date: Mon, 14 Dec 2015 11:08:34 -0500 Subject: [PATCH] Redcarpetify index; edit default filter --- filters/default.md | 2 +- index.md | 43 ++++++++++++++++++------------------------- 2 files changed, 19 insertions(+), 26 deletions(-) diff --git a/filters/default.md b/filters/default.md index a92055f8..d948bea0 100644 --- a/filters/default.md +++ b/filters/default.md @@ -2,7 +2,7 @@ title: default --- -`default` offers a means of having a fallback in case your value doesn't exist. `default` will use its substitute if the left side is `nil`, `false`, or empty. +`default` lets you specify a fallback in case a value doesn't exist. `default` will show its value if the left side is `nil`, `false`, or empty. In this example, `product_price` is not defined, so the default value is used. diff --git a/index.md b/index.md index ad6266b8..fc2bfc84 100644 --- a/index.md +++ b/index.md @@ -22,9 +22,15 @@ Objects and variable names are denoted by double curly braces: `{% raw %}{{{% en For example, you can show basic content like a page title using a Liquid object: -| Liquid | Output | -|:----------------------------------------|:---------| -| {% raw %}`{{ page.title }}`{% endraw %} | Overview | +```liquid +{% raw %} +{{ page.title }} +{% endraw %} +``` + +```text +Overview +``` In this case, Liquid is rendering the content of an object called `page.title`, and that object contains the text `Overview`. @@ -40,27 +46,20 @@ Tag markup does not resolve to text. This means that you can assign variables an #### Conditionals -For example, you can change what information Liquid shows using conditionals: +Conditionals can change the information Liquid shows using programming logic: -

Liquid

-
-{% highlight liquid %} +```liquid {% raw %} - {% if user %} Hello {{ user.name }}! {% endif %} {% endraw %} -{% endhighlight %} -
+``` -

Output

-
-{% highlight text %} +```text Hello Adam! -{% endhighlight %} -
+``` This conditional statement `if user` checks to see if an object called `user` exists. If the condition is *true* (that is, if there is a `user`), Liquid shows any content that is contained between the `if` and `endif` tags. @@ -70,9 +69,7 @@ In this case, our user's `name` is Adam, so the template prints `Hello Adam!`. You can also use tags to loop over a list or array of objects: -

Liquid

-
-{% highlight liquid %} +```liquid {% raw %} {% for item in collection %} @@ -80,18 +77,14 @@ You can also use tags to loop over a list or array of objects: {% endfor %} {% endraw %} -{% endhighlight %} -
+``` -

Output

-
-{% highlight text %} +```text I have a shirt I have a pants I have a banana I have a bucket -{% endhighlight %} -
+``` The statement `for item in collection` tells Liquid to show the content between the `for` and `endfor` tags one time for every `item` in the `collection` object.