├── src ├── content │ ├── markdown │ │ ├── escaped-angles.md │ │ ├── gfm-del.md │ │ ├── lazy-blockquotes.md │ │ ├── not-a-link.md │ │ ├── same-bullet.md │ │ ├── gfm-em.md │ │ ├── nested-code.md │ │ ├── nested-square-link.md │ │ ├── case-insensitive-refs.md │ │ ├── gfm-break.md │ │ ├── nested-blockquotes.md │ │ ├── nested-em.md │ │ ├── gfm-links.md │ │ ├── list-item-text.md │ │ ├── hr-list-break.md │ │ ├── autolink-lines.md │ │ ├── blockquote-list-item.md │ │ ├── strong-and-em-together.md │ │ ├── literal-quotes-in-titles.md │ │ ├── code-spans.md │ │ ├── blockquotes-with-code-blocks.md │ │ ├── def-blocks.md │ │ ├── double-link.md │ │ ├── inline-html-advanced.md │ │ ├── inline-html-comments.md │ │ ├── hard-wrapped-paragraphs-with-list-like-lines.md │ │ ├── code-blocks.md │ │ ├── gfm-code.md │ │ ├── links-inline-style.md │ │ ├── links-shortcut-references.md │ │ ├── auto-links.md │ │ ├── loose-lists.md │ │ ├── gfm-tables.md │ │ ├── horizontal-rules.md │ │ ├── gfm-code-hr-list.md │ │ ├── inline-html-simple.md │ │ ├── links-reference-style.md │ │ ├── main.md │ │ ├── ordered-and-unordered-lists.md │ │ ├── backslash-escapes.md │ │ └── markdown-documentation-basics.md │ ├── wiki │ │ ├── templates-partials.md │ │ ├── options-layout.md │ │ ├── data-yaml.md │ │ ├── options-partials.md │ │ ├── options-engine.md │ │ ├── options-assets.md │ │ ├── options-data.md │ │ ├── data-types.md │ │ ├── options-helpers.md │ │ ├── templates-helpers.md │ │ ├── data.md │ │ ├── options-collections.md │ │ ├── data-context.md │ │ ├── options-layoutdir.md │ │ ├── options-ext.md │ │ ├── templates-layouts.md │ │ ├── options.md │ │ └── data-yaml-front-matter.md │ └── TOC.md ├── templates │ ├── pages │ │ ├── index.hbs │ │ ├── toc.hbs │ │ ├── markdown-globbing-1.hbs │ │ ├── examples.hbs │ │ ├── markdown-globbing-2.hbs │ │ ├── markdown-block-2.hbs │ │ ├── markdown-globbing-3.hbs │ │ ├── render-readme.hbs │ │ └── markdown-block-1.hbs │ ├── layouts │ │ ├── markdown-1.hbs │ │ ├── default.hbs │ │ └── markdown-2.hbs │ └── partials │ │ ├── sidenav.hbs │ │ └── navbar.hbs └── helpers │ └── helper-include.js ├── .travis.yml ├── .gitignore ├── bower.json ├── .gitattributes ├── LICENSE-MIT ├── package.json ├── Gruntfile.js ├── dest ├── assets │ ├── github.css │ └── highlight.js ├── examples.html ├── TOC.md ├── DOCUMENTATION.md ├── DOCUMENTATION.html ├── toc.html ├── markdown-block-1.html ├── index.html ├── markdown-block-2.html └── render-readme.html ├── .verbrc.md └── README.md /src/content/markdown/escaped-angles.md: -------------------------------------------------------------------------------- 1 | \> 2 | -------------------------------------------------------------------------------- /src/content/markdown/gfm-del.md: -------------------------------------------------------------------------------- 1 | hello ~~hi~~ world 2 | -------------------------------------------------------------------------------- /src/content/markdown/lazy-blockquotes.md: -------------------------------------------------------------------------------- 1 | > hi there 2 | bud 3 | -------------------------------------------------------------------------------- /src/content/markdown/not-a-link.md: -------------------------------------------------------------------------------- 1 | \\[test](not a link) 2 | -------------------------------------------------------------------------------- /src/content/markdown/same-bullet.md: -------------------------------------------------------------------------------- 1 | * test 2 | + test 3 | - test 4 | -------------------------------------------------------------------------------- /src/content/markdown/gfm-em.md: -------------------------------------------------------------------------------- 1 | These words should_not_be_emphasized. 2 | -------------------------------------------------------------------------------- /src/content/markdown/nested-code.md: -------------------------------------------------------------------------------- 1 | ````` hi ther `` ok ``` ````` 2 | -------------------------------------------------------------------------------- /src/content/markdown/nested-square-link.md: -------------------------------------------------------------------------------- 1 | [the `]` character](/url) 2 | -------------------------------------------------------------------------------- /src/content/markdown/case-insensitive-refs.md: -------------------------------------------------------------------------------- 1 | [hi] 2 | 3 | [HI]: /url 4 | -------------------------------------------------------------------------------- /src/content/markdown/gfm-break.md: -------------------------------------------------------------------------------- 1 | Look at the 2 | pretty line 3 | breaks. 4 | -------------------------------------------------------------------------------- /src/content/markdown/nested-blockquotes.md: -------------------------------------------------------------------------------- 1 | > foo 2 | > 3 | > > bar 4 | > 5 | > foo 6 | -------------------------------------------------------------------------------- /src/content/markdown/nested-em.md: -------------------------------------------------------------------------------- 1 | *test **test** test* 2 | 3 | _test __test__ test_ 4 | -------------------------------------------------------------------------------- /src/content/markdown/gfm-links.md: -------------------------------------------------------------------------------- 1 | This should be a link: http://example.com/hello-world. 2 | -------------------------------------------------------------------------------- /src/content/markdown/list-item-text.md: -------------------------------------------------------------------------------- 1 | * item1 2 | 3 | * item2 4 | 5 | text 6 | -------------------------------------------------------------------------------- /src/templates/pages/index.hbs: -------------------------------------------------------------------------------- 1 | --- 2 | title: Home 3 | --- 4 | {{md 'README.md'}} 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/content/markdown/hr-list-break.md: -------------------------------------------------------------------------------- 1 | * hello 2 | world 3 | * how 4 | are 5 | * * * 6 | you today? 7 | -------------------------------------------------------------------------------- /src/content/markdown/autolink-lines.md: -------------------------------------------------------------------------------- 1 | ## Autolink Lines 2 | 3 | hello world 4 | 5 | -------------------------------------------------------------------------------- /src/content/markdown/blockquote-list-item.md: -------------------------------------------------------------------------------- 1 | This fails in markdown.pl and upskirt: 2 | 3 | * hello 4 | > world 5 | -------------------------------------------------------------------------------- /src/templates/pages/toc.hbs: -------------------------------------------------------------------------------- 1 | --- 2 | title: Table of Contents 3 | --- 4 |

TOC

5 | 6 | {{md 'src/content/TOC.md'}} 7 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "0.8" 4 | before_script: 5 | - npm install -g grunt-cli 6 | - npm install grunt 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | npm-debug.log 3 | 4 | tmp 5 | temp 6 | TODO.md 7 | 8 | *.sublime-project 9 | *.sublime-workspace 10 | -------------------------------------------------------------------------------- /src/content/markdown/strong-and-em-together.md: -------------------------------------------------------------------------------- 1 | ***This is strong and em.*** 2 | 3 | So is ***this*** word. 4 | 5 | ___This is strong and em.___ 6 | 7 | So is ___this___ word. 8 | -------------------------------------------------------------------------------- /src/content/markdown/literal-quotes-in-titles.md: -------------------------------------------------------------------------------- 1 | Foo [bar][]. 2 | 3 | Foo [bar](/url/ "Title with "quotes" inside"). 4 | 5 | 6 | [bar]: /url/ "Title with "quotes" inside" 7 | 8 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "assemble-examples-markdown", 3 | "dependencies": { 4 | "grunt-contrib-clean": "~0.4.1", 5 | "assemble": "~0.4.0", 6 | "grunt": "~0.4.1" 7 | } 8 | } -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Set default behaviour, in case users don't have core.autocrlf set. 2 | * text=lf 3 | * text eol=lf 4 | *.* eol=lf 5 | 6 | *.jpg binary 7 | *.gif binary 8 | *.png binary 9 | *.jpeg binary -------------------------------------------------------------------------------- /src/content/markdown/code-spans.md: -------------------------------------------------------------------------------- 1 | `` 2 | 3 | Fix for backticks within HTML tag: like this 4 | 5 | Here's how you put `` `backticks` `` in a code span. 6 | 7 | -------------------------------------------------------------------------------- /src/content/markdown/blockquotes-with-code-blocks.md: -------------------------------------------------------------------------------- 1 | > Example: 2 | > 3 | > sub status { 4 | > print "working"; 5 | > } 6 | > 7 | > Or: 8 | > 9 | > sub status { 10 | > return "working"; 11 | > } 12 | -------------------------------------------------------------------------------- /src/templates/layouts/markdown-1.hbs: -------------------------------------------------------------------------------- 1 | # {{title}} 2 | 3 | > {{{description}}} 4 | {{> body }} 5 | 6 | --- 7 | _This file was generated using [Grunt.js](https://gruntjs.com) and [Assemble](https://github.com/assemble/assemble) on {{now "%m/%d/%Y"}}._ -------------------------------------------------------------------------------- /src/templates/pages/markdown-globbing-1.hbs: -------------------------------------------------------------------------------- 1 | --- 2 | title: Markdown Globbing 3 | section: Markdown Helpers 4 | examples: ['src/content/markdown/*.md'] 5 | --- 6 | 7 |

Markdown

8 | {{#each examples}} 9 | {{md this}} 10 | {{/each}} 11 | -------------------------------------------------------------------------------- /src/content/markdown/def-blocks.md: -------------------------------------------------------------------------------- 1 | > hello 2 | > [1]: hello 3 | 4 | * * * 5 | 6 | > hello 7 | [2]: hello 8 | 9 | 10 | * hello 11 | * [3]: hello 12 | 13 | 14 | * hello 15 | [4]: hello 16 | 17 | 18 | > foo 19 | > bar 20 | [1]: foo 21 | > bar 22 | -------------------------------------------------------------------------------- /src/content/markdown/double-link.md: -------------------------------------------------------------------------------- 1 |

Already linked: http://example.com/.

2 | 3 | Already linked: [http://example.com/](http://example.com/). 4 | 5 | Already linked: **http://example.com/**. 6 | -------------------------------------------------------------------------------- /src/content/markdown/inline-html-advanced.md: -------------------------------------------------------------------------------- 1 | Simple block on one line: 2 | 3 |
foo
4 | 5 | And nested without indentation: 6 | 7 |
8 |
9 |
10 | foo 11 |
12 |
13 |
14 |
bar
15 |
16 | -------------------------------------------------------------------------------- /src/content/markdown/inline-html-comments.md: -------------------------------------------------------------------------------- 1 | Paragraph one. 2 | 3 | 4 | 5 | 8 | 9 | Paragraph two. 10 | 11 | 12 | 13 | The end. 14 | -------------------------------------------------------------------------------- /src/content/markdown/hard-wrapped-paragraphs-with-list-like-lines.md: -------------------------------------------------------------------------------- 1 | In Markdown 1.0.0 and earlier. Version 2 | 8. This line turns into a list item. 3 | Because a hard-wrapped line in the 4 | middle of a paragraph looked like a 5 | list item. 6 | 7 | Here's one with a bullet. 8 | * criminey. 9 | -------------------------------------------------------------------------------- /src/content/markdown/code-blocks.md: -------------------------------------------------------------------------------- 1 | code block on the first line 2 | 3 | Regular text. 4 | 5 | code block indented by spaces 6 | 7 | Regular text. 8 | 9 | the lines in this block 10 | all contain trailing spaces 11 | 12 | Regular Text. 13 | 14 | code block on the last line 15 | -------------------------------------------------------------------------------- /src/content/markdown/gfm-code.md: -------------------------------------------------------------------------------- 1 | ``` js 2 | var a = 'hello'; 3 | console.log(a + ' world'); 4 | ``` 5 | 6 | ~~~bash 7 | echo "hello, ${WORLD}" 8 | ~~~ 9 | 10 | ```````longfence 11 | Q: What do you call a tall person who sells stolen goods? 12 | ``````` 13 | 14 | ~~~~~~~~~~ ManyTildes 15 | A longfence! 16 | ~~~~~~~~~~ 17 | -------------------------------------------------------------------------------- /src/content/markdown/links-inline-style.md: -------------------------------------------------------------------------------- 1 | Just a [URL](/url/). 2 | 3 | [URL and title](/url/ "title"). 4 | 5 | [URL and title](/url/ "title preceded by two spaces"). 6 | 7 | [URL and title](/url/ "title preceded by a tab"). 8 | 9 | [URL and title](/url/ "title has spaces afterward" ). 10 | 11 | 12 | [Empty](). 13 | -------------------------------------------------------------------------------- /src/content/markdown/links-shortcut-references.md: -------------------------------------------------------------------------------- 1 | This is the [simple case]. 2 | 3 | [simple case]: /simple 4 | 5 | 6 | 7 | This one has a [line 8 | break]. 9 | 10 | This one has a [line 11 | break] with a line-ending space. 12 | 13 | [line break]: /foo 14 | 15 | 16 | [this] [that] and the [other] 17 | 18 | [this]: /this 19 | [that]: /that 20 | [other]: /other 21 | -------------------------------------------------------------------------------- /src/content/markdown/auto-links.md: -------------------------------------------------------------------------------- 1 | ## Auto Links 2 | 3 | Link: . 4 | 5 | With an ampersand: 6 | 7 | * In a list? 8 | * 9 | * It should. 10 | 11 | > Blockquoted: 12 | 13 | Auto-links should not occur here: `` 14 | 15 | or here: 16 | -------------------------------------------------------------------------------- /src/templates/pages/examples.hbs: -------------------------------------------------------------------------------- 1 | --- 2 | title: Examples 3 | --- 4 | {{#markdown}} 5 | 6 | # {{title}} 7 | 8 | ## [Markdown Example #1](markdown-block-1.html) 9 | 10 | 11 | ## [Markdown Example #2](markdown-block-2.html) 12 | 13 | 14 | ## [Markdown Globbing #1](markdown-globbing-1.html) 15 | 16 | 17 | ## [Markdown Globbing #2](markdown-globbing-2.html) 18 | 19 | 20 | 21 | {{/markdown}} -------------------------------------------------------------------------------- /src/templates/pages/markdown-globbing-2.hbs: -------------------------------------------------------------------------------- 1 | --- 2 | title: Markdown Globbing 3 | section: Markdown Helpers 4 | --- 5 | 6 |

Options

7 | {{md 'src/content/wiki/options.md'}} 8 | {{md 'src/content/wiki/options-*.md'}} 9 | 10 | 11 |

Templates

12 | {{md 'src/content/wiki/templates-*.md'}} 13 | 14 | 15 |

Data

16 | {{md 'src/content/wiki/data.md'}} 17 | {{md 'src/content/wiki/data-*.md'}} 18 | -------------------------------------------------------------------------------- /src/templates/pages/markdown-block-2.hbs: -------------------------------------------------------------------------------- 1 | --- 2 | title: Markdown "Includes" 3 | section: Markdown Helpers 4 | description: In this example we're doing the same thing as in "three.hbs" but we're using the "include" helper to pull in content from an external file rather than writing it inline. 5 | --- 6 | {{#markdown}} 7 | 8 | # {{title}} 9 | > {{{description}}} 10 | 11 | --- 12 | 13 | {{include 'README.md'}} 14 | 15 | {{/markdown}} -------------------------------------------------------------------------------- /src/templates/pages/markdown-globbing-3.hbs: -------------------------------------------------------------------------------- 1 | --- 2 | title: Docs 3 | options: ['src/content/wiki/options.md', 'src/content/wiki/options-*.md'] 4 | templates: ['src/content/wiki/templates-*.md'] 5 | context: ['src/content/wiki/data.md', 'src/content/wiki/data-*.md'] 6 | --- 7 | 8 |

Options

9 | {{#each options}} 10 | {{md this}} 11 | {{/each}} 12 | 13 | 14 |

Templates

15 | {{#each templates}} 16 | {{md this}} 17 | {{/each}} 18 | 19 | 20 |

Data

21 | {{#each context}} 22 | {{md this}} 23 | {{/each}} 24 | -------------------------------------------------------------------------------- /src/content/markdown/loose-lists.md: -------------------------------------------------------------------------------- 1 | * hello 2 | world 3 | 4 | how 5 | are 6 | * you 7 | 8 | 9 | 10 | better behavior: 11 | 12 | * hello 13 | * world 14 | how 15 | 16 | are 17 | you 18 | 19 | * today 20 | * hi 21 | 22 | 23 | 24 | * hello 25 | 26 | * world 27 | * hi 28 | 29 | 30 | 31 | * hello 32 | * world 33 | 34 | * hi 35 | 36 | 37 | 38 | * hello 39 | * world 40 | 41 | how 42 | * hi 43 | 44 | 45 | 46 | * hello 47 | * world 48 | * how 49 | 50 | are 51 | 52 | 53 | 54 | * hello 55 | * world 56 | 57 | * how 58 | 59 | are 60 | -------------------------------------------------------------------------------- /src/content/markdown/gfm-tables.md: -------------------------------------------------------------------------------- 1 | | Heading 1 | Heading 2 2 | | --------- | --------- 3 | | Cell 1 | Cell 2 4 | | Cell 3 | Cell 4 5 | 6 | | Header 1 | Header 2 | Header 3 | Header 4 | 7 | | :------: | -------: | :------- | -------- | 8 | | Cell 1 | Cell 2 | Cell 3 | Cell 4 | 9 | | Cell 5 | Cell 6 | Cell 7 | Cell 8 | 10 | 11 | Test code 12 | 13 | Header 1 | Header 2 14 | -------- | -------- 15 | Cell 1 | Cell 2 16 | Cell 3 | Cell 4 17 | 18 | Header 1|Header 2|Header 3|Header 4 19 | :-------|:------:|-------:|-------- 20 | Cell 1 |Cell 2 |Cell 3 |Cell 4 21 | *Cell 5*|Cell 6 |Cell 7 |Cell 8 22 | -------------------------------------------------------------------------------- /src/content/markdown/horizontal-rules.md: -------------------------------------------------------------------------------- 1 | Dashes: 2 | 3 | --- 4 | 5 | --- 6 | 7 | --- 8 | 9 | --- 10 | 11 | --- 12 | 13 | - - - 14 | 15 | - - - 16 | 17 | - - - 18 | 19 | - - - 20 | 21 | - - - 22 | 23 | 24 | Asterisks: 25 | 26 | *** 27 | 28 | *** 29 | 30 | *** 31 | 32 | *** 33 | 34 | *** 35 | 36 | * * * 37 | 38 | * * * 39 | 40 | * * * 41 | 42 | * * * 43 | 44 | * * * 45 | 46 | 47 | Underscores: 48 | 49 | ___ 50 | 51 | ___ 52 | 53 | ___ 54 | 55 | ___ 56 | 57 | ___ 58 | 59 | _ _ _ 60 | 61 | _ _ _ 62 | 63 | _ _ _ 64 | 65 | _ _ _ 66 | 67 | _ _ _ 68 | -------------------------------------------------------------------------------- /src/templates/partials/sidenav.hbs: -------------------------------------------------------------------------------- 1 | 18 | -------------------------------------------------------------------------------- /src/content/wiki/templates-partials.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | > Partials are reusable fragments of code that can be included in a page and rendered 4 | 5 | 6 | ## Syntax 7 | 8 | Partials are useful when you have blocks of reusable code that is applicable in different contexts. The `Handlebars.registerPartial` method, which registers a partial, accepts the name of the partial as its first argument and either a _template source string_ or a _compiled template_ as its second argument. 9 | 10 | Accepting a compiled template as the second argument enables you, for example, to use the partial in a loop that outputs a list but also append items to the list later using the partial’s template function. 11 | 12 | To use a partial from a template, simply include `\{{> partial-name }}`. For example: 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/content/markdown/gfm-code-hr-list.md: -------------------------------------------------------------------------------- 1 | ## foo 2 | 3 | 1. bar: 4 | 5 | > - one 6 | - two 7 | - three 8 | - four 9 | - five 10 | 11 | 1. foo: 12 | 13 | ``` 14 | line 1 15 | line 2 16 | ``` 17 | 18 | 1. foo: 19 | 20 | 1. foo `bar` bar: 21 | 22 | ``` erb 23 | some code here 24 | ``` 25 | 26 | 2. foo `bar` bar: 27 | 28 | ``` erb 29 | foo 30 | --- 31 | bar 32 | --- 33 | foo 34 | bar 35 | ``` 36 | 37 | 3. foo `bar` bar: 38 | 39 | ``` html 40 | --- 41 | foo 42 | foo 43 | --- 44 | bar 45 | ``` 46 | 47 | 4. foo `bar` bar: 48 | 49 | foo 50 | --- 51 | bar 52 | 53 | 5. foo 54 | -------------------------------------------------------------------------------- /src/helpers/helper-include.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | module.exports.register = function(Handlebars, options) { 3 | 4 | var path = require("path"); 5 | var grunt = require('grunt'); 6 | var _ = grunt.util._; 7 | 8 | /* 9 | * Usage: {{ include [partial] }} 10 | */ 11 | Handlebars.registerHelper("include", function(template, options) { 12 | var partial = Handlebars.partials[template]; 13 | if (typeof partial === "string") { 14 | partial = Handlebars.compile(partial); 15 | Handlebars.partials[template] = partial; 16 | } 17 | if (!partial) { 18 | return new Handlebars.SafeString('Partial **' + template + '** not found.'); 19 | } 20 | var context = _.extend({}, this, options.hash); 21 | return new Handlebars.SafeString(partial(context)); 22 | }); 23 | 24 | }; 25 | }).call(this); 26 | -------------------------------------------------------------------------------- /src/content/markdown/inline-html-simple.md: -------------------------------------------------------------------------------- 1 | Here's a simple block: 2 | 3 |
4 | foo 5 |
6 | 7 | This should be a code block, though: 8 | 9 |
10 | foo 11 |
12 | 13 | As should this: 14 | 15 |
foo
16 | 17 | Now, nested: 18 | 19 |
20 |
21 |
22 | foo 23 |
24 |
25 |
26 | 27 | This should just be an HTML comment: 28 | 29 | 30 | 31 | Multiline: 32 | 33 | 37 | 38 | Code block: 39 | 40 | 41 | 42 | Just plain comment, with trailing spaces on the line: 43 | 44 | 45 | 46 | Code: 47 | 48 |
49 | 50 | Hr's: 51 | 52 |
53 | 54 |
55 | 56 |
57 | 58 |
59 | 60 |
61 | 62 |
63 | 64 |
65 | 66 |
67 | 68 |
69 | 70 | -------------------------------------------------------------------------------- /src/content/wiki/options-layout.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## options.layout 4 | 5 | > Layouts are commonly used with client-side templates as a quick way to "wrap" a number of [pages][] with commonly used page "sections", such as the head, footer or navigation. 6 | 7 | ## Defining Layouts 8 | Oftentimes you will need more than one layout for your project, so layouts can be defined using the `options.layout` variable at the task or target-level, or they can be specified at the page-level by adding a `layout` property to the [YFM][YAML front matter]. 9 | 10 | 11 | ## The `\{{> body }}` tag 12 | Although layouts are optional, the `\{{> body }}` tag is required for content to be pulled into a layout. 13 | 14 | ```html 15 | 16 | 17 | 18 | \{{title}} 19 | 20 | 21 | 22 | \{{> body }} 23 | 24 | 25 | ``` 26 | 27 | ## Related Info 28 | 29 | * Learn about [Layouts][] 30 | * Learn about [layoutdir][] 31 | -------------------------------------------------------------------------------- /src/content/wiki/data-yaml.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | > YAML is a "human-readable data serialization format" that may be used with Assemble as an alternative to JSON 4 | 5 | As a data format, YAML may be used as an alternative to JSON. 6 | 7 | 8 | 9 | ## [YAML front matter][yaml-front-matter] 10 | 11 | > YAML front matter was made popular by Jekyll, the "blog-aware, static site generator" that powers GitHub Pages. 12 | 13 | YAML front-matter is optionally used at the beginning of a page to define metadata for the page's content. In order for YAML front-matter to be processed, it _must be the first thing at the top of the page_, and it must be "wrapped" properly using three dashes above (`---`) and three below (`---`). 14 | 15 | **More information** 16 | 17 | * Visit [http://www.yaml.org/](http://www.yaml.org/) 18 | * Go to assemble's wiki page on [YAML front matter][] 19 | * See some great usage examples in assemble's [YAML test files](https://assemble/assemble/test/actual/yaml): 20 | 21 | 22 | 23 | 24 | 25 | [js-yaml]: https://github.com/nodeca/js-yaml -------------------------------------------------------------------------------- /src/templates/pages/render-readme.hbs: -------------------------------------------------------------------------------- 1 | --- 2 | title: Markdown "Includes" 3 | section: Markdown Helpers 4 | description: In this example we're doing the same thing as in "three.hbs" but we're using the "include" helper to pull in content from an external file rather than writing it inline. 5 | --- 6 | {{#markdown}} 7 | 8 | # {{title}} 9 | > {{{description}}} 10 | 11 | --- 12 | 13 | {{include 'README.md'}} 14 | 15 | {{/markdown}} 16 | 17 | -------------------------------------------------------------------------------- /LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Jon Schlinkert 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /src/content/markdown/links-reference-style.md: -------------------------------------------------------------------------------- 1 | Foo [bar] [1]. 2 | 3 | Foo [bar][1]. 4 | 5 | Foo [bar] 6 | [1]. 7 | 8 | [1]: /url/ "Title" 9 | 10 | 11 | With [embedded [brackets]] [b]. 12 | 13 | 14 | Indented [once][]. 15 | 16 | Indented [twice][]. 17 | 18 | Indented [thrice][]. 19 | 20 | Indented [four][] times. 21 | 22 | [once]: /url 23 | 24 | [twice]: /url 25 | 26 | [thrice]: /url 27 | 28 | [four]: /url 29 | 30 | 31 | [b]: /url/ 32 | 33 | * * * 34 | 35 | [this] [this] should work 36 | 37 | So should [this][this]. 38 | 39 | And [this] []. 40 | 41 | And [this][]. 42 | 43 | And [this]. 44 | 45 | But not [that] []. 46 | 47 | Nor [that][]. 48 | 49 | Nor [that]. 50 | 51 | [Something in brackets like [this][] should work] 52 | 53 | [Same with [this].] 54 | 55 | In this case, [this](/somethingelse/) points to something else. 56 | 57 | Backslashing should suppress \[this] and [this\]. 58 | 59 | [this]: foo 60 | 61 | 62 | * * * 63 | 64 | Here's one where the [link 65 | breaks] across lines. 66 | 67 | Here's another where the [link 68 | breaks] across lines, but with a line-ending space. 69 | 70 | 71 | [link breaks]: /url/ 72 | -------------------------------------------------------------------------------- /src/templates/partials/navbar.hbs: -------------------------------------------------------------------------------- 1 | --- 2 | component: navbar 3 | --- 4 | 6 | -------------------------------------------------------------------------------- /src/templates/layouts/default.hbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{title}} 6 | 7 | 8 | 9 | 10 | 11 | 12 | 14 | {{> navbar }} 15 | 16 | 17 | 19 |
20 |
21 |
22 |
23 |

Docs / {{#if section}}{{ section }} {{else}} Markdown {{/if}}

24 |
25 |
26 |
27 |
28 | 29 | 30 | 32 |
33 |
34 | {{> sidenav }} 35 |
36 | 37 |
38 | {{> body }} 39 |
40 |
41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/content/markdown/main.md: -------------------------------------------------------------------------------- 1 | [test]: http://google.com/ "Google" 2 | 3 | # A heading 4 | 5 | Just a note, I've found that I can't test my markdown parser vs others. 6 | For example, both markdown.js and showdown code blocks in lists wrong. They're 7 | also completely [inconsistent][test] with regards to paragraphs in list items. 8 | 9 | A link. Not anymore. 10 | 11 | 13 | 14 | * List Item 1 15 | 16 | * List Item 2 17 | * New List Item 1 18 | Hi, this is a list item. 19 | * New List Item 2 20 | Another item 21 | Code goes here. 22 | Lots of it... 23 | * New List Item 3 24 | The last item 25 | 26 | * List Item 3 27 | The final item. 28 | 29 | * List Item 4 30 | The real final item. 31 | 32 | Paragraph. 33 | 34 | > * bq Item 1 35 | > * bq Item 2 36 | > * New bq Item 1 37 | > * New bq Item 2 38 | > Text here 39 | 40 | * * * 41 | 42 | > Another blockquote! 43 | > I really need to get 44 | > more creative with 45 | > mockup text.. 46 | > markdown.js breaks here again 47 | 48 | Another Heading 49 | ------------- 50 | 51 | Hello *world*. Here is a [link](//hello). 52 | And an image ![alt](src). 53 | 54 | Code goes here. 55 | Lots of it... 56 | -------------------------------------------------------------------------------- /src/templates/layouts/markdown-2.hbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{title}} 6 | 7 | 8 | 9 | 10 | 11 | 12 | 14 | {{> navbar }} 15 | 16 | 17 | 19 |
20 |
21 |
22 |
23 |

{{ uppercase title }}

24 |
25 |
26 |
27 |
28 | 29 | 30 | 32 |
33 |
34 | 35 |
36 |

{{{description}}}

37 |
38 | 39 | {{#markdown}} 40 | {{> body }} 41 | {{/markdown}} 42 |
43 |
44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "assemble-examples-markdown", 3 | "description": "Use Assemble to generate HTML pages from markdown content. Useful for wikis, gh-pages, documentation and blogs or sites with markdown posts.", 4 | "version": "0.1.0", 5 | "homepage": "https://github.com/assemble/assemble-examples-markdown/", 6 | "author": { 7 | "name": "Assemble" 8 | }, 9 | "contributors": [ 10 | { 11 | "name": "Jon Schlinkert", 12 | "url": "https://github.com/jonschlinkert" 13 | }, 14 | { 15 | "name": "Brian Woodward", 16 | "url": "https://github.com/doowb" 17 | } 18 | ], 19 | "repository": { 20 | "type": "git", 21 | "url": "git://github.com/assemble/assemble-examples-markdown.git" 22 | }, 23 | "bugs": { 24 | "url": "https://github.com/assemble/assemble-examples-markdown/issues" 25 | }, 26 | "licenses": [ 27 | { 28 | "type": "MIT", 29 | "url": "https://github.com/assemble/assemble-examples-markdown/blob/master/LICENSE-MIT" 30 | } 31 | ], 32 | "main": "Gruntfile.js", 33 | "scripts": { 34 | "test": "grunt assemble" 35 | }, 36 | "dependencies": { 37 | "grunt-contrib-clean": "~0.4.1", 38 | "assemble": "~0.4.0", 39 | "grunt": "~0.4.1" 40 | }, 41 | "keywords": [ 42 | "markdown", 43 | "markdown to html", 44 | "jekyll alternative", 45 | "jekyll node.js", 46 | "content", 47 | "assemble", 48 | "build", 49 | "site generator", 50 | "component generator", 51 | "blog generator", 52 | "handlebars", 53 | "templates" 54 | ], 55 | "devDependencies": { 56 | "grunt-verb": "~0.2.3" 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/content/wiki/options-partials.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ## Registering Partials 6 | 7 | Assemble automatically registers any partials supplied via the `partials` option at the task or target levels. 8 | 9 | ``` javascript 10 | assemble { 11 | docs: { 12 | options: { 13 | partials: ['src/templates/partials/**/*.md'] 14 | }, 15 | files: { 16 | 'docs/': ['src/templates/pages/*.md'] 17 | } 18 | } 19 | } 20 | ``` 21 | 22 | ### Task-target behavior 23 | 24 | Any partials registered at the _task_ level are are also available at the _target_ level. 25 | 26 | **Important!** It is standard in Grunt.js for target-level options to overwrite task-level options. However, assemble merges the list of partials defined at the task-level with the partials defined for each target. 27 | 28 | 29 | ## Usage examples 30 | 31 | ### Ways to apply context to partials 32 | 33 | #### "Inline" 34 | 35 | You can establish context inside the partials: 36 | 37 | ``` handlebars 38 | \{{> module module.panel-primary}} 39 | \{{> module module.panel-info}} 40 | \{{> module module.panel-success}} 41 | \{{> module module.panel-warning}} 42 | \{{> module module.panel-danger}} 43 | \{{> module module.panel-query}} 44 | ``` 45 | 46 | #### Block expressions 47 | 48 | Wrap partials in block expressions and either set the context on the partial: 49 | 50 | ``` handlebars 51 | \{{#module}} 52 | \{{> module panel-inverse}} 53 | \{{> module panel-success}} 54 | \{{> module panel-info}} 55 | \{{/module}} 56 | ``` 57 | 58 | Or on the section tags: 59 | 60 | ``` handlebars 61 | \{{#module.panel-base}} 62 | \{{> module }} 63 | \{{/module.panel-base}} 64 | ``` 65 | -------------------------------------------------------------------------------- /src/content/markdown/ordered-and-unordered-lists.md: -------------------------------------------------------------------------------- 1 | ## Unordered 2 | 3 | Asterisks tight: 4 | 5 | * asterisk 1 6 | * asterisk 2 7 | * asterisk 3 8 | 9 | 10 | Asterisks loose: 11 | 12 | * asterisk 1 13 | 14 | * asterisk 2 15 | 16 | * asterisk 3 17 | 18 | * * * 19 | 20 | Pluses tight: 21 | 22 | + Plus 1 23 | + Plus 2 24 | + Plus 3 25 | 26 | 27 | Pluses loose: 28 | 29 | + Plus 1 30 | 31 | + Plus 2 32 | 33 | + Plus 3 34 | 35 | * * * 36 | 37 | 38 | Minuses tight: 39 | 40 | - Minus 1 41 | - Minus 2 42 | - Minus 3 43 | 44 | 45 | Minuses loose: 46 | 47 | - Minus 1 48 | 49 | - Minus 2 50 | 51 | - Minus 3 52 | 53 | 54 | ## Ordered 55 | 56 | Tight: 57 | 58 | 1. First 59 | 2. Second 60 | 3. Third 61 | 62 | and: 63 | 64 | 1. One 65 | 2. Two 66 | 3. Three 67 | 68 | 69 | Loose using tabs: 70 | 71 | 1. First 72 | 73 | 2. Second 74 | 75 | 3. Third 76 | 77 | and using spaces: 78 | 79 | 1. One 80 | 81 | 2. Two 82 | 83 | 3. Three 84 | 85 | Multiple paragraphs: 86 | 87 | 1. Item 1, graf one. 88 | 89 | Item 2. graf two. The quick brown fox jumped over the lazy dog's 90 | back. 91 | 92 | 2. Item 2. 93 | 94 | 3. Item 3. 95 | 96 | 97 | 98 | ## Nested 99 | 100 | * Tab 101 | * Tab 102 | * Tab 103 | 104 | Here's another: 105 | 106 | 1. First 107 | 2. Second: 108 | * Fee 109 | * Fie 110 | * Foe 111 | 3. Third 112 | 113 | Same thing but with paragraphs: 114 | 115 | 1. First 116 | 117 | 2. Second: 118 | * Fee 119 | * Fie 120 | * Foe 121 | 122 | 3. Third 123 | 124 | 125 | This was an error in Markdown 1.0.1: 126 | 127 | * this 128 | 129 | * sub 130 | 131 | that 132 | -------------------------------------------------------------------------------- /Gruntfile.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Assemble, assemble-examples-markdown 3 | * https://github.com/assemble/assemble-examples-markdown 4 | * Copyright (c) 2013 Jon Schlinkert 5 | * Licensed under the MIT license. 6 | */ 7 | 8 | 'use strict'; 9 | 10 | module.exports = function(grunt) { 11 | 12 | // Project configuration. 13 | grunt.initConfig({ 14 | 15 | assemble: { 16 | options: { 17 | flatten: true, 18 | helpers: 'src/helpers/helper-*.js', 19 | assets: 'dest/assets', 20 | layoutdir: 'src/templates/layouts', 21 | partials: ['src/templates/partials/*.hbs', './*.md'] 22 | }, 23 | html1: { 24 | options: { 25 | layout: 'default.hbs', 26 | }, 27 | files: { 28 | 'dest/': ['src/templates/pages/*.hbs'] 29 | } 30 | }, 31 | html2: { 32 | options: { 33 | ext: '.html', 34 | engine: 'handlebars', 35 | layout: 'markdown-2.hbs' 36 | }, 37 | files: { 38 | 'dest/': ['src/content/*.md'] 39 | } 40 | }, 41 | markdown: { 42 | options: { 43 | ext: '.md', 44 | engine: 'handlebars', 45 | layout: 'markdown-1.hbs' 46 | }, 47 | files: { 48 | 'dest/': ['src/content/*.md'] 49 | } 50 | } 51 | }, 52 | 53 | // Before generating any new files, 54 | // remove any previously-created files. 55 | clean: { 56 | example: ['dest/*.{html,md}'] 57 | } 58 | }); 59 | 60 | // Load npm plugins to provide necessary tasks. 61 | grunt.loadNpmTasks('assemble'); 62 | grunt.loadNpmTasks('grunt-contrib-clean'); 63 | grunt.loadNpmTasks('grunt-verb'); 64 | 65 | // Default tasks to be run. 66 | grunt.registerTask('default', ['assemble']); 67 | }; 68 | 69 | -------------------------------------------------------------------------------- /src/content/markdown/backslash-escapes.md: -------------------------------------------------------------------------------- 1 | ## Backslash Escapes 2 | 3 | These should all get escaped: 4 | 5 | Backslash: \\ 6 | 7 | Backtick: \` 8 | 9 | Asterisk: \* 10 | 11 | Underscore: \_ 12 | 13 | Left brace: \{ 14 | 15 | Right brace: \} 16 | 17 | Left bracket: \[ 18 | 19 | Right bracket: \] 20 | 21 | Left paren: \( 22 | 23 | Right paren: \) 24 | 25 | Greater-than: \> 26 | 27 | Hash: \# 28 | 29 | Period: \. 30 | 31 | Bang: \! 32 | 33 | Plus: \+ 34 | 35 | Minus: \- 36 | 37 | 38 | 39 | These should not, because they occur within a code block: 40 | 41 | Backslash: \\ 42 | 43 | Backtick: \` 44 | 45 | Asterisk: \* 46 | 47 | Underscore: \_ 48 | 49 | Left brace: \{ 50 | 51 | Right brace: \} 52 | 53 | Left bracket: \[ 54 | 55 | Right bracket: \] 56 | 57 | Left paren: \( 58 | 59 | Right paren: \) 60 | 61 | Greater-than: \> 62 | 63 | Hash: \# 64 | 65 | Period: \. 66 | 67 | Bang: \! 68 | 69 | Plus: \+ 70 | 71 | Minus: \- 72 | 73 | 74 | Nor should these, which occur in code spans: 75 | 76 | Backslash: `\\` 77 | 78 | Backtick: `` \` `` 79 | 80 | Asterisk: `\*` 81 | 82 | Underscore: `\_` 83 | 84 | Left brace: `\{` 85 | 86 | Right brace: `\}` 87 | 88 | Left bracket: `\[` 89 | 90 | Right bracket: `\]` 91 | 92 | Left paren: `\(` 93 | 94 | Right paren: `\)` 95 | 96 | Greater-than: `\>` 97 | 98 | Hash: `\#` 99 | 100 | Period: `\.` 101 | 102 | Bang: `\!` 103 | 104 | Plus: `\+` 105 | 106 | Minus: `\-` 107 | 108 | 109 | These should get escaped, even though they're matching pairs for 110 | other Markdown constructs: 111 | 112 | \*asterisks\* 113 | 114 | \_underscores\_ 115 | 116 | \`backticks\` 117 | 118 | This is a code span with a literal backslash-backtick sequence: `` \` `` 119 | 120 | This is a tag with unescaped backticks bar. 121 | 122 | This is a tag with backslashes bar. 123 | -------------------------------------------------------------------------------- /src/content/wiki/options-engine.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## `init` method 4 | 5 | Describes `init` method to `assemble.engine`, and exposes engine on `assemble.engine`. 6 | 7 | 8 | ### Custom Engines 9 | 10 | If you don't wish to use Handlebars as your templates engine, you may add your own engine by providing an `init` function that takes in options from the assemble task/target. You may also override the `init` function in the task/target options by providing an `initializeEngine` function that takes the engine and the options: 11 | 12 | ```js 13 | assemble: { 14 | options: { 15 | engine: 'consolidate', 16 | initializeEngine: function(engine, options) { 17 | engine.engine.swig.init(options); 18 | } 19 | }, 20 | docs: { 21 | files: { 22 | 'docs/': ['src/templates/**/*.tmpl'] 23 | } 24 | } 25 | } 26 | ``` 27 | 28 | Assemble will attempt to load an engine and automatically add it's own wrapper methods around it while holding an instance of the engine. This is a way for engine plugin authors to write adapters between other engines and assemble's wrapper. To make these functions on the options useful, we've exposed the underlying engine through the `assemble.engine` object so **developers can use the raw engine**. 29 | 30 | This is particularly useful when **a)** a library such as [consolidate][] is used, where the engine is `consolidate`, and **b)** the developer wants to use another engine such as [handlebars](https://github.com/wycats/handlebars.js), [swig](https://github.com/paularmstrong/swig), [mustache](https://github.com/janl/mustache.js) etc. 31 | 32 | * The `init` function allows assemble to pass in options to be used in initializing this engine plugin. 33 | * `init` function is exposed, and [helper-lib](https://github.com/assemble/helper-lib) is registered inside the init so that options can be passed in. 34 | 35 | Admittedly, the `engine.engine` syntax is strange. This is "alpha", so feedback and pull requests are especially welcome if you have ideas for improving this. 36 | -------------------------------------------------------------------------------- /src/content/wiki/options-assets.md: -------------------------------------------------------------------------------- 1 | 2 | ## options.assets 3 | 4 | > "Assets" directory to be used by dest files in a target. 5 | 6 | Type: `String` (optional) 7 | Default: `undefined` 8 | 9 | _`options.assets` may be defined at the task- and/or target-levels._ 10 | 11 | ## Overview 12 | Oftentimes an "assets" directory is used in projects for containing the CSS, JavaScripts, images and other similar files. 13 | 14 | Once the `assets` variable is defined in the Gruntfile, you may use the `\{{assets}}` variable anywhere in your templates and Assemble will generate a relative path from `dest` files to the specified `assets` directory. 15 | 16 | 17 | ## Example usage 18 | 19 | Given the following task configuration in your project's Grunfile: 20 | 21 | ``` js 22 | assemble: { 23 | options: { 24 | // Set the "default" assets dir at the task-level 25 | assets: 'docs/assets' 26 | }, 27 | docs: { 28 | files: { 29 | 'docs/': ['src/pages/**/*.hbs'] 30 | } 31 | }, 32 | components: { 33 | files: { 34 | 'docs/components/': ['src/partials/**/*.hbs'] 35 | } 36 | }, 37 | main: { 38 | options: { 39 | // Override the task-level assets dir 40 | assets: 'dist/assets' 41 | }, 42 | files: { 43 | 'dist/': ['src/pages/**/*.hbs'] 44 | } 45 | } 46 | // other stuff 47 | } 48 | ``` 49 | 50 | And given the following templates: 51 | 52 | ```html 53 | 54 | ``` 55 | 56 | The output HTML will render as follows: 57 | 58 | For the `assemble.docs` target 59 | 60 | ```html 61 | 62 | ``` 63 | 64 | For the `assemble.components` target 65 | 66 | ```html 67 | 68 | ``` 69 | 70 | For the `assemble.main` target 71 | 72 | ```html 73 | 74 | ``` 75 | 76 | **Note** that for `assets` to work predictably, _a slash must follow the `\{{assets}} variable_ 77 | 78 | 79 | ## More information 80 | 81 | * [Options][] 82 | * [variables][built-in-variables] -------------------------------------------------------------------------------- /dest/assets/github.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | github.com style (c) Vasily Polovnyov 4 | 5 | */ 6 | 7 | pre code { 8 | display: block; padding: 0.5em; 9 | color: #333; 10 | background: #f8f8ff 11 | } 12 | 13 | pre .comment, 14 | pre .template_comment, 15 | pre .diff .header, 16 | pre .javadoc { 17 | color: #998; 18 | font-style: italic 19 | } 20 | 21 | pre .keyword, 22 | pre .css .rule .keyword, 23 | pre .winutils, 24 | pre .javascript .title, 25 | pre .nginx .title, 26 | pre .subst, 27 | pre .request, 28 | pre .status { 29 | color: #333; 30 | font-weight: bold 31 | } 32 | 33 | pre .number, 34 | pre .hexcolor, 35 | pre .ruby .constant { 36 | color: #099; 37 | } 38 | 39 | pre .string, 40 | pre .tag .value, 41 | pre .phpdoc, 42 | pre .tex .formula { 43 | color: #d14 44 | } 45 | 46 | pre .title, 47 | pre .id, 48 | pre .coffeescript .params, 49 | pre .scss .preprocessor { 50 | color: #900; 51 | font-weight: bold 52 | } 53 | 54 | pre .javascript .title, 55 | pre .lisp .title, 56 | pre .clojure .title, 57 | pre .subst { 58 | font-weight: normal 59 | } 60 | 61 | pre .class .title, 62 | pre .haskell .type, 63 | pre .vhdl .literal, 64 | pre .tex .command { 65 | color: #458; 66 | font-weight: bold 67 | } 68 | 69 | pre .tag, 70 | pre .tag .title, 71 | pre .rules .property, 72 | pre .django .tag .keyword { 73 | color: #000080; 74 | font-weight: normal 75 | } 76 | 77 | pre .attribute, 78 | pre .variable, 79 | pre .lisp .body { 80 | color: #008080 81 | } 82 | 83 | pre .regexp { 84 | color: #009926 85 | } 86 | 87 | pre .class { 88 | color: #458; 89 | font-weight: bold 90 | } 91 | 92 | pre .symbol, 93 | pre .ruby .symbol .string, 94 | pre .lisp .keyword, 95 | pre .tex .special, 96 | pre .prompt { 97 | color: #990073 98 | } 99 | 100 | pre .built_in, 101 | pre .lisp .title, 102 | pre .clojure .built_in { 103 | color: #0086b3 104 | } 105 | 106 | pre .preprocessor, 107 | pre .pi, 108 | pre .doctype, 109 | pre .shebang, 110 | pre .cdata { 111 | color: #999; 112 | font-weight: bold 113 | } 114 | 115 | pre .deletion { 116 | background: #fdd 117 | } 118 | 119 | pre .addition { 120 | background: #dfd 121 | } 122 | 123 | pre .diff .change { 124 | background: #0086b3 125 | } 126 | 127 | pre .chunk { 128 | color: #aaa 129 | } -------------------------------------------------------------------------------- /src/templates/pages/markdown-block-1.hbs: -------------------------------------------------------------------------------- 1 | --- 2 | title: Inline Markdown 3 | section: Markdown Helpers 4 | description: In this example markdown content from the README is written in between the open and close "markdown" block expressions so that it will be rendered to HTML. Handlebars templates are also embedded in the markdown for rendering the metadata from our YAML front matter. 5 | --- 6 | 7 | {{#markdown}} 8 | 9 | # {{title}} 10 | 11 | > {{{description}}} 12 | 13 | The markdown used in this example was borrowed from Assemble's wiki. Expect to find broken links since the "complete build" for the wiki includes components that are not present in this repo. 14 | 15 | 16 | ## Getting started 17 | 18 | If you have trouble getting started, please visit the documentation at http://assemble.io, or [create an Issue](https://github.com/assemble/assemble/issues) at Assemble's GitHub repo, we're happy to help. 19 | 20 | This plugin requires Grunt `~0.4.1`. If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command: 21 | 22 | ```shell 23 | npm install assemble --save-dev 24 | ``` 25 | 26 | Once the plugin has been installed, it may be enabled inside your [Gruntfile][Getting Started] with this line of JavaScript: 27 | 28 | ```js 29 | grunt.loadNpmTasks('assemble'); 30 | ``` 31 | 32 | ## The "assemble" task 33 | In your project's Gruntfile, add a section named `assemble` to the data object passed into `grunt.initConfig()`. 34 | 35 | ```js 36 | grunt.initConfig({ 37 | assemble: { 38 | options: { 39 | // Task-specific options go here. 40 | }, 41 | your_target: { 42 | // Target-specific file lists and/or options go here. 43 | } 44 | } 45 | }); 46 | grunt.loadNpmTasks('assemble'); 47 | 48 | grunt.registerTask('default', [ 49 | 'jshint', 50 | 'assemble' 51 | ]); 52 | ``` 53 | Task targets, files and options may be specified according to the grunt [Configuring tasks](http://gruntjs.com/configuring-tasks) guide. 54 | 55 | 56 | You should now be able to run `grunt assemble` to build the project. 57 | 58 | Visit [Assemble's documentation](http://assemble.io) for more information. 59 | 60 | 61 | ## Contributing 62 | In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [grunt][]. 63 | 64 | ## Release History 65 | _(Nothing yet)_ 66 | 67 | {{/markdown}} -------------------------------------------------------------------------------- /src/content/wiki/options-data.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Also see the wiki page for [data types][data]. 5 | 6 | 7 | 8 | 9 | ## Supplying data to templates 10 | 11 | You must first define the paths to any data files you wish to use via the `options.data` object in the `assemble` task or target, then Assemble will automatically supply data to your templates: 12 | 13 | ``` 14 | assemble: { 15 | options: { 16 | data: 'src/data/*.json' 17 | } 18 | files: { 19 | 'site/': ['src/pages/*.hbs'] 20 | } 21 | } 22 | ``` 23 | 24 | ### Matching names 25 | 26 | Context to the name of the data file is the same as the associated template, and we 27 | 28 | To use "external" data files (versus YAML front matter), y 29 | 30 | 31 | 32 | **"widget component" example** 33 | 34 | Given a data file, such as `widget.json` or `widget.yml` : 35 | 36 | ``` json 37 | { 38 | "name": "This is a square widget", 39 | "modifier": "widget-square" 40 | } 41 | ``` 42 | 43 | With the following Handlebars expressions in out template, `widget.hbs` : 44 | 45 | ``` html 46 |
\{{ widget.name }}
47 | ``` 48 | 49 | The result after running `grunt assemble` will be: 50 | 51 | ``` html 52 |
This is a square widget
53 | ``` 54 | 55 | **package.json example #1** 56 | 57 | Add `package.json` to the `data` object: 58 | 59 | ``` javascript 60 | assemble { 61 | myProject: { 62 | options: { 63 | data: 'package.json' 64 | }, 65 | files: { 66 | 'dest': ['src/templates/**/*.hbs'] 67 | } 68 | } 69 | } 70 | ``` 71 | 72 | And we will not be able to retrieve metadata from `package.json` by using variables such as: 73 | 74 | * `\{{package.verson}}` 75 | * `\{{package.name}}` 76 | * `\{{package.description}}` 77 | * `\{{package.author.url}}` 78 | * `\{{package.author.name}}` 79 | 80 | 81 | 82 | **package.json example #2** 83 | 84 | Assuming we add the following code to our Gruntfile 85 | 86 | ``` javascript 87 | pkg: grunt.file.readJSON('package.json'), 88 | 89 | assemble { 90 | myProject: { 91 | options: { 92 | pkg: '<%= pkg %>', 93 | data: 'other/data/*.json' 94 | }, 95 | files: { 96 | 'dest': ['src/templates/**/*.hbs'] 97 | } 98 | } 99 | } 100 | ``` 101 | 102 | We can now use the following expresions in our templates: 103 | 104 | * `\{{pkg.verson}}` 105 | * `\{{pkg.name}}` 106 | * `\{{pkg.description}}` 107 | * `\{{pkg.author.url}}` 108 | * `\{{pkg.author.name}}` 109 | 110 | 111 | Also see: [YAML front matter][yaml-front-matter] 112 | 113 | 114 | ## Related Info 115 | 116 | * [Complete list of Options][Options] 117 | * [Data Types][data] 118 | * [variables][built-in-variables] 119 | 120 | -------------------------------------------------------------------------------- /src/content/wiki/data-types.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | > Mix and match JSON, YAML, YAML front matter, and data stored in the Gruntfile however you want. 4 | 5 | 6 | 7 | ## Accepted data types 8 | 9 | Any of the following data formats may be used: 10 | 11 | * [JSON][json] files, such as `my-data.json` 12 | * [YAML][yaml] files, such as `my-data.yml` 13 | * [YAML Front-Matter][yfm], embedded directly inside the page/template itself 14 | 15 | Visit the [options.data][options-data] page to learn about supplying data to your templates. 16 | 17 | ## Usage examples 18 | 19 | Let's start by creating a template, which can be any kind of markdown, text, xml or markup/HTML that we want to use. For this example our template is going to be HTML, and since I'm feeling creative let's call it `my-template.hbs`. 20 | 21 | Now, focusing only on the `head` of our HTML document, let's add template variables for `title` and `author` so that we can later replace them with real data: 22 | 23 | ```html 24 | 25 | 26 | 27 | \{{title}} 28 | 29 | 30 | 31 | 32 | 33 | ``` 34 | 35 | Handlebars.js is the default template engine in Assemble, so our variables are wrapped in "Handlebars expressions": `\{{` and `}}`. 36 | 37 | ### JSON example 38 | 39 | Here is an example of what we might put inside of `my-template.json` to populate our template with data. 40 | 41 | ```json 42 | { 43 | "title": "Assemble", 44 | "author": "Brian Woodward" 45 | } 46 | ``` 47 | ### YAML example 48 | 49 | Here is the same in YAML format: `my-template.yml` 50 | ``` yaml 51 | title: Assemble 52 | author: Brian Woodward 53 | ``` 54 | 55 | And this template: 56 | 57 | `my-template.hbs` 58 | ``` 59 |

\{{ title }}

60 | ``` 61 | 62 | ### YAML front-matter example 63 | 64 | Or, in cases where we only require simple metadata we can use YAML Front-matter to eliminate the need for an external data file: 65 | 66 | ``` yaml 67 | --- 68 | title: Assemble 69 | author: Brian Woodward 70 | --- 71 | 72 |

\{{ title }}

73 | ``` 74 | 75 | Outputs: 76 | 77 | ```html 78 |

Assemble

79 |

Brian Woodward

80 | ``` 81 | 82 | ### Underscore and yaml front-matter 83 | 84 | Furthermore, we can optionally use underscore templates in the YAML front-matter to translate external variables into data inside the content: 85 | 86 | ``` yaml 87 | --- 88 | title: <%= some.title.variable %> 89 | author: <%= some.author.variable %> 90 | --- 91 | 92 |

\{{ title }}

93 |

\{{ author }}

94 | ``` 95 | 96 | ## FAQ 97 | 98 | * Assemble merges task and target level data supplied from `options.data`. 99 | 100 | 101 | 102 | 103 | 104 | 105 | ## Related Info 106 | 107 | * [Complete list of Options][Options] 108 | * [options.data][options-data] 109 | * [Variables][built-in-variables] 110 | 111 | -------------------------------------------------------------------------------- /src/content/wiki/options-helpers.md: -------------------------------------------------------------------------------- 1 | 2 | ## options.helpers 3 | 4 | > Helpers manipulate the output of variables 5 | 6 | For the most part helper expressions follow this pattern: `\{{ helper_name variable_name }}`. For example: 7 | 8 | ``` 9 | \{{ uppercase title }} 10 | ``` 11 | Renders to: 12 | 13 | ``` 14 | PAGE TITLE 15 | ``` 16 | 17 | ## Custom helpers 18 | Custom helpers may be loaded with the current engine via `options: { helpers: []}` in the assemble task or target. But _any helpers registered at the target level will override task-level helpers_. 19 | 20 | Globbing patterns may be used to specify paths to the helpers to be loaded: 21 | 22 | ```js 23 | assemble: { 24 | options: { 25 | helpers: ['./lib/helpers/**/*.js'] 26 | } 27 | } 28 | ``` 29 | 30 | ### Registering custom helpers 31 | 32 | Helpers can either be an object or a single `register` function. If `register` is on the object, then it calls the `register` function passing in the engine, otherwise each method is registered as a helper. For example, the following will result in 2 helpers being registered: 33 | 34 | ```js 35 | module.exports.foo = function(msg) { return msg; }; 36 | module.exports.bar = function(msg) { return msg; }; 37 | ``` 38 | 39 | And this will result in the `foo` helper getting register directly through Handlebars: 40 | 41 | ```js 42 | module.exports.register = function(Handlebars, options) { 43 | Handlebars.registerHelper('foo', function(msg) { 44 | return msg; 45 | }); 46 | }; 47 | ``` 48 | 49 | The `Handlebars.registerHelper` method takes the name of the helper and the helper function as arguments. Handlebars.js then takes whatever is returned from the helper function and writes it out to the template, _so be sure to always return a string from your custom helpers_. 50 | 51 | 52 | ## Passing `assemble.options` into helpers 53 | Any `assemble.options` may be passed to custom helpers when the helper defines the `register` method. For example: 54 | 55 | Given our `Gruntfile.js` has the following `assemble` task configuration: 56 | 57 | ```js 58 | assemble: { 59 | options: { 60 | version: '0.1.0', // or we could use '<%= pkg.version %>' 61 | helpers: ['lib/helpers/**/*.js'] 62 | }, 63 | blog: { 64 | files: { 65 | 'articles/': ['src/posts/*.md'] 66 | } 67 | } 68 | } 69 | ``` 70 | 71 | And given we have defined a custom helper, `opt`, which gets properties from the `assemble.options` object and returns them: 72 | 73 | ```js 74 | module.exports.register = register = function(Handlebars, options) { 75 | 76 | Handlebars.registerHelper('opt', function(key) { 77 | return options[key] || ''; 78 | }); 79 | 80 | }; 81 | ``` 82 | 83 | We can now user our helper in a Handlebars template like this: 84 | 85 | ``` html 86 |
Version: v\{{opt 'version'}}
87 | ``` 88 | 89 | And the output would be: 90 | 91 | ``` html 92 |
Version: v0.1.0
93 | ``` 94 | 95 | ## Related Info 96 | 97 | * [Helpers][] 98 | * [Options][] -------------------------------------------------------------------------------- /dest/examples.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Examples 6 | 7 | 8 | 9 | 10 | 11 | 12 | 14 | 15 | 17 | 40 | 41 | 42 | 44 |
45 |
46 |
47 |
48 |

Docs / Markdown

49 |
50 |
51 |
52 |
53 | 54 | 55 | 57 |
58 |
59 | 76 |
77 | 78 |
79 | 80 |

Examples

81 |

Markdown Example #1

82 |

Markdown Example #2

83 |

Markdown Globbing #1

84 |

Markdown Globbing #2

85 | 86 |
87 |
88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /src/content/wiki/templates-helpers.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ## Built-in Helpers 5 | 6 | Assemble includes [helper-lib][] as a dependency, so all of the helpers from that library are available by default. 7 | 8 | [helper-lib][] includes more than **100 Handlebars helpers** from that library in your templates. 9 | 10 | 11 | ### Helpers created for Assemble 12 | 13 | Most helpers from [helper-lib][] can be used with any Handlebars project, but a handful of helpers were created specifically for Assemble, including: 14 | 15 | * **dirname**: Returns the absolute path to the given file/directory. Would return: `path/to/variables.md`. Usage: `\{{dirname [path]}}` 16 | * **pagename**: Returns the full-name of a given file. Would return: `variables.md`. Usage: `\{{filename "docs/toc.md"}}` 17 | * **filename**: Can be used as an alternate for `pagename`. 18 | * **basename**: Returns the basename of a given file. Would return: `variables` Usage: `\{{base "docs/toc.md"}}` 19 | * **extension**: Returns the extension of a given file. Would return: `.md` Usage: `\{{extension "docs/toc.md"}}` 20 | * **ext**: Can be used as an alternate for`extension`. 21 | * **relative**: Returns the derived relative path from file A to file B. Usage: `\{{relative [from] [to]}}`. This can also be used with `page` and `pages`. 22 | * **markdown**: Markdown block helper enables writing markdown inside HTML and then renders the markdown as HTML inline with the rest of the page. Usage: `\{{#markdown}}\{{/markdown}}` 23 | * **md**: Markdown helper used to read in a file and inject the rendered markdown into the HTML. Usage: `\{{md [path]}}` 24 | * **embed**: Embeds code from an external file as preformatted text. The first parameter requires a path to the file you want to embed. The second optional parameter allows forcing syntax highlighting for a specific language. Usage: `\{{embed 'path/to/file.js'}}` or `\{{embed 'path/to/file.hbs' 'html'}}` 25 | * **jsFiddle**: Embed a jsFiddle, second parameter sets the desired tabs. Usage: `\{{jsfiddle [id] [tabs]}}` 26 | * **gist**: Downloads and embeds public GitHub Gists by adding only the Id of the Gist. Usage: `\{{gist [id] [file]}}` 27 | * **authors**: Reads in data from an "AUTHORS" file to generate markdown formatted author or list of authors for a README.md. Accepts a second optional parameter to a different file than the default. Usage: `\{{authors}}` or `\{{ authors [file] }}` 28 | * **changelog**: Reads in data from an "CHANGELOG" file to generate markdown formatted changelog or list of changelog entries for a README.md. Accepts a second optional parameter to change to a different file than the default. Usage: `\{{changelog [src]}}` 29 | * **roadmap**: Reads in data from an "ROADMAP" file to generate markdown formatted roadmap or list of roadmap entries for a README.md. Accepts a second optional parameter to change to a different file than the default. Usage: `\{{roadmap [src]}}` 30 | 31 | Many additional helpers are available in the following categories: 32 | * `assemble` 33 | * `collections` 34 | * `comparisons` 35 | * `dates` 36 | * `file` 37 | * `html` 38 | * `inflections` 39 | * `logging` 40 | * `markdown` 41 | * `math` 42 | * `miscellaneous` 43 | * `numbers` 44 | * `objects` 45 | * `path` 46 | * `special` 47 | * `strings` 48 | * `url` 49 | 50 | Visit [helper-lib][] to learn more. 51 | 52 | 53 | ## Related info 54 | 55 | * [Templates][templates] 56 | * [helper-lib Github repo][] 57 | * [handlebarsjs.com][handlebars] 58 | 59 | 60 | [helper-lib]: http://github.com/assemble/helper-lib "Extensive collection of Handlebars helpers" 61 | 62 | -------------------------------------------------------------------------------- /.verbrc.md: -------------------------------------------------------------------------------- 1 | # {%= name %} {%= badge("fury") %} 2 | 3 | > {%= description %} 4 | 5 | #### Thank you to [Upstage](https://github.com/upstage) for the theme used in the [live demo](http://assemble.github.io/boilerplate-markdown) (the same used on http://assemble.io)! 6 | 7 | This is not intended to be "documentation" for Assemble, the content used in this project is for example purposes. So you will learn by browsing the source code, rendered code, and seeing how it renders in the browser. 8 | 9 | ## Related information 10 | 11 | * [grunt-init-assemble](https://github.com/assemble/grunt-init-assemble): use [grunt-init](http://gruntjs.com/project-scaffolding) to launch new Assemble projects in seconds. 12 | * [Assemble's documentation](http://assemble.io): if you want to learn more about Assemble in general, this is a great place to start. 13 | * [assemble-boilerplate](https://github.com/assemble/assemble-boilerplate): see more examples. 14 | 15 | 16 | ## What you'll see in the examples 17 | 18 | * How to use [file globbing](https://github.com/isaacs/node-glob) to include multiple markdown files based on specified patterns. 19 | 20 | ### Rendering markdown to markdown 21 | 22 | * How to generate markdown files from markdown pages. See [../src/content/TOC.md](../src/content/TOC.md) 23 | * How to use markdown "includes" that either render to HTML or render as markdown 24 | * How to use markdown layouts for generating markdown files 25 | 26 | ### Rendering markdown to HTML 27 | 28 | * How to write markdown "inline" with HTML and have it render to HTML 29 | * How to generate HTML files from markdown pages, layouts and content. 30 | 31 | 32 | ## Getting started 33 | 34 | If you have trouble getting started, please visit the documentation at http://assemble.io, or [create an Issue](https://github.com/assemble/assemble/issues) at Assemble's GitHub repo, we're happy to help. 35 | 36 | This plugin requires Grunt `~0.4.1`. If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command: 37 | 38 | ```shell 39 | npm install assemble --save-dev 40 | ``` 41 | 42 | Once the plugin has been installed, it may be enabled inside your [Gruntfile][Getting Started] with this line of JavaScript: 43 | 44 | ```js 45 | grunt.loadNpmTasks('assemble'); 46 | ``` 47 | 48 | ## The "assemble" task 49 | In your project's Gruntfile, add a section named `assemble` to the data object passed into `grunt.initConfig()`. 50 | 51 | ```js 52 | grunt.initConfig({ 53 | assemble: { 54 | options: { 55 | // Task-specific options go here. 56 | }, 57 | your_target: { 58 | // Target-specific file lists and/or options go here. 59 | } 60 | } 61 | }); 62 | grunt.loadNpmTasks('assemble'); 63 | 64 | grunt.registerTask('default', [ 65 | 'jshint', 66 | 'assemble' 67 | ]); 68 | ``` 69 | Task targets, files and options may be specified according to the grunt [Configuring tasks](http://gruntjs.com/configuring-tasks) guide. 70 | 71 | 72 | You should now be able to run `grunt assemble` to build the project. 73 | 74 | Visit [Assemble's documentation](http://assemble.io) for more information. 75 | 76 | 77 | ## Contributing 78 | In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [grunt][]. 79 | 80 | ## Release History 81 | _(Nothing yet)_ 82 | -------------------------------------------------------------------------------- /src/content/wiki/data.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | > Mix and match JSON, YAML, YAML front matter, and data stored in the Gruntfile however you want. 4 | 5 | 6 | Table of Contents 7 | 8 | * Data Formats 9 | * The "data" Object 10 | 11 | 12 | 13 | 14 | ## Data Formats 15 | 16 | Any of the following data formats may be used: 17 | 18 | * [JSON][json] files, such as `my-data.json` 19 | * [YAML][yaml] files, such as `my-data.yml` 20 | * [YAML Front-Matter][yfm], embedded directly inside the page/template itself 21 | 22 | Visit the [options.data][options-data] page to learn about supplying data to your templates. 23 | 24 | ## Usage examples 25 | 26 | Let's start by creating a template, which can be any kind of markdown, text, xml or markup/HTML that we want to use. For this example our template is going to be HTML, and since I'm feeling creative let's call it `my-template.hbs`. 27 | 28 | Now, focusing only on the `head` of our HTML document, let's add template variables for `title` and `author` so that we can later replace them with real data: 29 | 30 | ```html 31 | 32 | 33 | 34 | \{{title}} 35 | 36 | 37 | 38 | 39 | 40 | ``` 41 | 42 | Handlebars.js is the default template engine in Assemble, so our variables are wrapped in "Handlebars expressions": `\{{` and `}}`. 43 | 44 | ### JSON example 45 | 46 | Here is an example of what we might put inside of `my-template.json` to populate our template with data. 47 | 48 | ```json 49 | { 50 | "title": "Assemble", 51 | "author": "Brian Woodward" 52 | } 53 | ``` 54 | ### YAML example 55 | 56 | Here is the same in YAML format: `my-template.yml` 57 | ``` yaml 58 | title: Assemble 59 | author: Brian Woodward 60 | ``` 61 | 62 | And this template: 63 | 64 | `my-template.hbs` 65 | ``` 66 |

\{{ title }}

67 | ``` 68 | 69 | ### YAML front-matter example 70 | 71 | Or, in cases where we only require simple metadata we can use YAML Front-matter to eliminate the need for an external data file: 72 | 73 | ``` yaml 74 | --- 75 | title: Assemble 76 | author: Brian Woodward 77 | --- 78 | 79 |

\{{ title }}

80 | ``` 81 | 82 | Outputs: 83 | 84 | ```html 85 |

Assemble

86 |

Brian Woodward

87 | ``` 88 | 89 | ### Underscore and yaml front-matter 90 | 91 | Furthermore, we can optionally use underscore templates in the YAML front-matter to translate external variables into data inside the content: 92 | 93 | ``` yaml 94 | --- 95 | title: <%= some.title.variable %> 96 | author: <%= some.author.variable %> 97 | --- 98 | 99 |

\{{ title }}

100 |

\{{ author }}

101 | ``` 102 | 103 | ## The "data" Object 104 | 105 | 106 | Using `data.json` or `data.yml` should work, but works a little bit differently than if you put data into a file called `myData.json`. When the data is in `data.json`, it's loaded directly into the root of the context... 107 | 108 | `data.json`: 109 | 110 | ```json 111 | { 112 | "title": "My Title" 113 | } 114 | ``` 115 | 116 | `myTemplate.hbs`: 117 | 118 | ```handlebars 119 | Data 120 | ``` 121 | 122 | When used in `myData.json`, the data can be accessed through the name of the file... 123 | 124 | `myData.json`: 125 | ```json 126 | { 127 | "title": "My Title" 128 | } 129 | ``` 130 | 131 | `myTemplate.hbs`: 132 | ```handlebars 133 | 134 | ``` 135 | 136 | 137 | 138 | ## Related information: 139 | 140 | * [options.data][options-data] 141 | * [Complete list of Options][Options] 142 | * [Context][] 143 | * [Templates][] 144 | * [Variables][built-in-variables] 145 | 146 | 147 | 148 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # assemble-examples-markdown [![NPM version](https://badge.fury.io/js/assemble-examples-markdown.png)](http://badge.fury.io/js/assemble-examples-markdown) 2 | 3 | > Use Assemble to generate HTML pages from markdown content. Useful for wikis, gh-pages, documentation and blogs or sites with markdown posts. 4 | 5 | #### Thank you to [Upstage](https://github.com/upstage) for the theme used in the [live demo](http://assemble.github.io/boilerplate-markdown) (the same used on http://assemble.io)! 6 | 7 | This is not intended to be "documentation" for Assemble, the content used in this project is for example purposes. So you will learn by browsing the source code, rendered code, and seeing how it renders in the browser. 8 | 9 | ## Related information 10 | 11 | * [grunt-init-assemble](https://github.com/assemble/grunt-init-assemble): use [grunt-init](http://gruntjs.com/project-scaffolding) to launch new Assemble projects in seconds. 12 | * [Assemble's documentation](http://assemble.io): if you want to learn more about Assemble in general, this is a great place to start. 13 | * [assemble-boilerplate](https://github.com/assemble/assemble-boilerplate): see more examples. 14 | 15 | 16 | ## What you'll see in the examples 17 | 18 | * How to use [file globbing](https://github.com/isaacs/node-glob) to include multiple markdown files based on specified patterns. 19 | 20 | ### Rendering markdown to markdown 21 | 22 | * How to generate markdown files from markdown pages. See [../src/content/TOC.md](../src/content/TOC.md) 23 | * How to use markdown "includes" that either render to HTML or render as markdown 24 | * How to use markdown layouts for generating markdown files 25 | 26 | ### Rendering markdown to HTML 27 | 28 | * How to write markdown "inline" with HTML and have it render to HTML 29 | * How to generate HTML files from markdown pages, layouts and content. 30 | 31 | 32 | ## Getting started 33 | 34 | If you have trouble getting started, please visit the documentation at http://assemble.io, or [create an Issue](https://github.com/assemble/assemble/issues) at Assemble's GitHub repo, we're happy to help. 35 | 36 | This plugin requires Grunt `~0.4.1`. If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command: 37 | 38 | ```shell 39 | npm install assemble --save-dev 40 | ``` 41 | 42 | Once the plugin has been installed, it may be enabled inside your [Gruntfile][Getting Started] with this line of JavaScript: 43 | 44 | ```js 45 | grunt.loadNpmTasks('assemble'); 46 | ``` 47 | 48 | ## The "assemble" task 49 | In your project's Gruntfile, add a section named `assemble` to the data object passed into `grunt.initConfig()`. 50 | 51 | ```js 52 | grunt.initConfig({ 53 | assemble: { 54 | options: { 55 | // Task-specific options go here. 56 | }, 57 | your_target: { 58 | // Target-specific file lists and/or options go here. 59 | } 60 | } 61 | }); 62 | grunt.loadNpmTasks('assemble'); 63 | 64 | grunt.registerTask('default', [ 65 | 'jshint', 66 | 'assemble' 67 | ]); 68 | ``` 69 | Task targets, files and options may be specified according to the grunt [Configuring tasks](http://gruntjs.com/configuring-tasks) guide. 70 | 71 | 72 | You should now be able to run `grunt assemble` to build the project. 73 | 74 | Visit [Assemble's documentation](http://assemble.io) for more information. 75 | 76 | 77 | ## Contributing 78 | In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [grunt][]. 79 | 80 | ## Release History 81 | _(Nothing yet)_ 82 | -------------------------------------------------------------------------------- /src/content/wiki/options-collections.md: -------------------------------------------------------------------------------- 1 | 2 | ## Default Collections 3 | 4 | The following built-in collections are available at the root of the context: 5 | 6 | | **Collection** | **Collection item** | **Description** | 7 | | -------------- | ------------------- | ------------------------------ | 8 | | `tags` | `tag` | Used to specify tags associated with the current page. Multiple tags may be associated with each page. Useful for adding semantic **tags** or tag clouds to your content. | 9 | | `categories` | `category` | Used to specify categories associated with the current page. Multiple categories may be associated with each page. Similar to tags but more appropriate for categorizing pages by "broader" concepts. | 10 | | `pages` | `page` | See **Pages collection differences** below | 11 | 12 | 13 | ### Pages collection differences 14 | 15 | "[Pages][]" and "page" differ from other collections and collection items in the following ways: 16 | 17 | * _Any files specified in the `src` of a given target_ will be the collection items associated with the "pages" object for that target. 18 | * Although a "page" is a collection item, there is currently no concept of "pages with related pages". In other words _there is no object which contains a collection of pages associated with a given page_. So 19 | 20 | 21 | ### Collection items 22 | 23 | 24 | You may then add items to collections in the YAML front matter of any files that should include those collections: 25 | 26 | ```yaml 27 | --- 28 | title: My Blog 29 | archives: 30 | - 2013 31 | - May 32 | - 12 33 | --- 34 | ``` 35 | 36 | ### List of associate pages 37 | 38 | Additionally, any collection item from the `collections` object can list the [pages][pages] associated with that collection. For example, each "tag" would list the [pages][pages] associated with that tag. 39 | 40 | ```javascript 41 | { 42 | tag: 'news', 43 | pages: ['one.html', 'two.html', 'three.html'] 44 | } 45 | ``` 46 | 47 | 48 | ## Custom collections 49 | 50 | ### options.collections 51 | 52 | type: `Array` 53 | default: `null` 54 | 55 | Custom `collections` may be defined using the `collections` option: 56 | 57 | 58 | ```javascript 59 | assemble: { 60 | options: { 61 | collections: ['archives', 'posts'] 62 | } 63 | } 64 | ``` 65 | 66 | And then in the YAML front matter of a page: 67 | 68 | 69 | ```yaml 70 | --- 71 | archives: 72 | - 2013 73 | - May 74 | - 12 75 | --- 76 | ``` 77 | 78 | There are no restrictions on the number of collections creatd, you may specify as many custom collections as you require. 79 | 80 | 81 | ### Automatic inflection 82 | Currently, for the sake of ease of use, the collection method uses the [inflection](https://github.com/dreamerslab/node.inflection) library to convert a collection's item key into the correct syntax: 83 | 84 | * `tags` converts to: `{ tag: 'ficus', pages: [] }` 85 | * `categories` converts to: `{ category: 'trees', pages: [] }` 86 | 87 | If words you wish to use are either missing or don't work properly, please let us know by [creating an Issue](https://github.com/assemble/assemble/issues/) on Assemble's GitHub repository. 88 | 89 | 90 | ## Usage examples 91 | 92 | Declaring tags and categories for a page within the page's [YAML front matter][yaml-front-matter] 93 | 94 | ``` yaml 95 | --- 96 | tags: 97 | - feature 98 | - priority 99 | categories: 100 | - open 101 | --- 102 | ``` 103 | 104 | **List all tags** 105 | 106 | ``` html 107 |
    108 | \{{#tags}} 109 |
  • \{{tag}}
  • 110 | \{{/tags}} 111 |
112 | ``` 113 | 114 | **List all categories** 115 | 116 | ``` html 117 |
    118 | \{{#categories}} 119 |
  • \{{category}}
  • 120 | \{{/categories}} 121 |
122 | ``` 123 | 124 | **List tags on current page** 125 | 126 | ``` html 127 |
    128 | \{{#page.tags}} 129 |
  • \{{.}}
  • 130 | \{{/page.tags}} 131 |
132 | ``` 133 | 134 | **List categories on current page** 135 | 136 | ``` html 137 |
    138 | \{{#page.categories}} 139 |
  • \{{.}}
  • 140 | \{{/page.categories}} 141 |
142 | ``` 143 | 144 | 145 | 146 | 147 | -------------------------------------------------------------------------------- /src/content/TOC.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Assemble Docs 3 | description: Visit Assemble's full documentation for more information about generating sites, documentation and components. 4 | --- 5 | ## [About][About] 6 | 7 | ### [Getting Started][Home] 8 | 9 | ### Configuration 10 | 11 | * [Built-In Variables][built-in-variables] 12 | * [Options][options] 13 | * [options.assets][options-assets] 14 | * [options.collections][options-collections] 15 | * [options.data][options-data] 16 | * [options.engine][options-engine] 17 | * [options.ext][options-ext] 18 | * [options.helpers][options-helpers] 19 | * [options.layout][options-layout] 20 | * [options.layoutdir][options-layoutdir] 21 | * [options.pagination][options-pagination] 22 | * [options.partials][options-partials] 23 | * [options.permalinks][options-permalinks] 24 | 25 | 26 | ### Templates 27 | 28 | * [Pages][pages] 29 | * [Layouts][layouts] 30 | * [Partials][partials] 31 | * [Helpers][Helpers] 32 | 33 | 34 | ### Data 35 | 36 | * [Data][data-types] 37 | * [JSON][json] 38 | * [YAML][yaml] 39 | * [YAML Front Matter][yaml-front-matter] 40 | 41 | 42 | ### Content 43 | 44 | * [Markdown][markdown] 45 | 46 | 47 | ### Examples 48 | 49 | * [All examples](https://github.com/assemble/assemble-examples) 50 | * [Creating a Basic Site](https://github.com/assemble/assemble-examples-basic) 51 | * [Generate a README or markdown docs](https://github.com/assemble/assemble-examples-readme) 52 | * [Create sitemap](https://github.com/assemble/assemble-examples-sitemap) 53 | 54 | 55 | ### Development 56 | 57 | * [Methods][methods] 58 | 59 | 60 | ### Other 61 | 62 | * [External Libraries][external-libraries] 63 | 64 | 65 | ## Related Projects 66 | 67 | * [assemble-init](https://github.com/assemble/assemble-init) 68 | * [assemble-less](https://github.com/assemble/assemble-less) 69 | * [assemble-manifest](https://github.com/assemble/assemble-manifest) 70 | 71 | 72 | 73 | [about]: http://assemble.io/docs/About.html 74 | [built-in-variables]: http://assemble.io/docs/Built-in-Variables.html 75 | [data-types]: http://assemble.io/docs/Data-Types.html 76 | [data]: http://assemble.io/docs/Data.html 77 | [examples]: https://github.com/assemble/assemble-examples "Assemble Examples" 78 | [extending-assemble]: http://assemble.io/docs/Extending-Assemble.html 79 | [external-libraries]: http://assemble.io/docs/External-Libraries.html 80 | [files]: http://gruntjs.com/configuring-tasks#files 81 | [handlebars]: http://handlebarsjs.com 82 | [helper-lib]: http://github.com/assemble/helper-lib "Extensive collection of Handlebars helpers" 83 | [helpers]: http://assemble.io/docs/Helpers.html 84 | [home]: http://assemble.io/docs/Home.html 85 | [index]: http://assemble.io/docs/index.html 86 | [installation]: http://assemble.io/docs/Installation.html 87 | [json]: http://assemble.io/docs/JSON.html 88 | [layouts]: http://assemble.io/docs/Layouts.html 89 | [lodash]: http://gruntjs.com/configuring-tasks#templates 90 | [markdown]: http://assemble.io/docs/Markdown.html 91 | [metadata]: http://assemble.io/docs/Metadata.html 92 | [methods]: http://assemble.io/docs/Methods.html 93 | [options]: http://assemble.io/docs/Options.html 94 | [options-assets]: http://assemble.io/docs/options-assets.html 95 | [options-collections]: http://assemble.io/docs/options-collections.html 96 | [options-data]: http://assemble.io/docs/options-data.html 97 | [options-engine]: http://assemble.io/docs/options-engine.html 98 | [options-ext]: http://assemble.io/docs/options-ext.html 99 | [options-helpers]: http://assemble.io/docs/options-helpers.html 100 | [options-layout]: http://assemble.io/docs/options-layout.html 101 | [options-layoutdir]: http://assemble.io/docs/options-layoutdir.html 102 | [options-pagination]: http://assemble.io/docs/options-pagination.html 103 | [options-partials]: http://assemble.io/docs/options-partials.html 104 | [options-permalinks]: http://assemble.io/docs/options-permalinks.html 105 | [outline]: http://assemble.io/docs/Outline.html 106 | [overview]: http://assemble.io/docs/Overview.html 107 | [pages]: http://assemble.io/docs/Pages.html 108 | [partials]: http://assemble.io/docs/Partials.html 109 | [quickstart]: http://assemble.io/docs/Quickstart.html 110 | [tasks-and-targets]: http://gruntjs.com/configuring-tasks#task-configuration-and-targets 111 | [templates]: http://assemble.io/docs/Templates.html 112 | [why-assemble]: http://assemble.io/docs/Why-Assemble.html 113 | [yaml-front-matter]: http://assemble.io/docs/YAML-front-matter.html 114 | [yaml]: http://assemble.io/docs/YAML.html 115 | [yfm]: http://assemble.io/docs/YAML-front-matter.html 116 | -------------------------------------------------------------------------------- /dest/TOC.md: -------------------------------------------------------------------------------- 1 | # Assemble Docs 2 | 3 | > Visit Assemble's full documentation for more information about generating sites, documentation and components. 4 | 5 | ## [About][About] 6 | 7 | ### [Getting Started][Home] 8 | 9 | ### Configuration 10 | 11 | * [Built-In Variables][built-in-variables] 12 | * [Options][options] 13 | * [options.assets][options-assets] 14 | * [options.collections][options-collections] 15 | * [options.data][options-data] 16 | * [options.engine][options-engine] 17 | * [options.ext][options-ext] 18 | * [options.helpers][options-helpers] 19 | * [options.layout][options-layout] 20 | * [options.layoutdir][options-layoutdir] 21 | * [options.pagination][options-pagination] 22 | * [options.partials][options-partials] 23 | * [options.permalinks][options-permalinks] 24 | 25 | 26 | ### Templates 27 | 28 | * [Pages][pages] 29 | * [Layouts][layouts] 30 | * [Partials][partials] 31 | * [Helpers][Helpers] 32 | 33 | 34 | ### Data 35 | 36 | * [Data][data-types] 37 | * [JSON][json] 38 | * [YAML][yaml] 39 | * [YAML Front Matter][yaml-front-matter] 40 | 41 | 42 | ### Content 43 | 44 | * [Markdown][markdown] 45 | 46 | 47 | ### Examples 48 | 49 | * [All examples](https://github.com/assemble/assemble-examples) 50 | * [Creating a Basic Site](https://github.com/assemble/assemble-examples-basic) 51 | * [Generate a README or markdown docs](https://github.com/assemble/assemble-examples-readme) 52 | * [Create sitemap](https://github.com/assemble/assemble-examples-sitemap) 53 | 54 | 55 | ### Development 56 | 57 | * [Methods][methods] 58 | 59 | 60 | ### Other 61 | 62 | * [External Libraries][external-libraries] 63 | 64 | 65 | ## Related Projects 66 | 67 | * [assemble-init](https://github.com/assemble/assemble-init) 68 | * [assemble-less](https://github.com/assemble/assemble-less) 69 | * [assemble-manifest](https://github.com/assemble/assemble-manifest) 70 | 71 | 72 | 73 | [about]: http://assemble.io/docs/About.html 74 | [built-in-variables]: http://assemble.io/docs/Built-in-Variables.html 75 | [data-types]: http://assemble.io/docs/Data-Types.html 76 | [data]: http://assemble.io/docs/Data.html 77 | [examples]: https://github.com/assemble/assemble-examples "Assemble Examples" 78 | [extending-assemble]: http://assemble.io/docs/Extending-Assemble.html 79 | [external-libraries]: http://assemble.io/docs/External-Libraries.html 80 | [files]: http://gruntjs.com/configuring-tasks#files 81 | [handlebars]: http://handlebarsjs.com 82 | [helper-lib]: http://github.com/assemble/helper-lib "Extensive collection of Handlebars helpers" 83 | [helpers]: http://assemble.io/docs/Helpers.html 84 | [home]: http://assemble.io/docs/Home.html 85 | [index]: http://assemble.io/docs/index.html 86 | [installation]: http://assemble.io/docs/Installation.html 87 | [json]: http://assemble.io/docs/JSON.html 88 | [layouts]: http://assemble.io/docs/Layouts.html 89 | [lodash]: http://gruntjs.com/configuring-tasks#templates 90 | [markdown]: http://assemble.io/docs/Markdown.html 91 | [metadata]: http://assemble.io/docs/Metadata.html 92 | [methods]: http://assemble.io/docs/Methods.html 93 | [options]: http://assemble.io/docs/Options.html 94 | [options-assets]: http://assemble.io/docs/options-assets.html 95 | [options-collections]: http://assemble.io/docs/options-collections.html 96 | [options-data]: http://assemble.io/docs/options-data.html 97 | [options-engine]: http://assemble.io/docs/options-engine.html 98 | [options-ext]: http://assemble.io/docs/options-ext.html 99 | [options-helpers]: http://assemble.io/docs/options-helpers.html 100 | [options-layout]: http://assemble.io/docs/options-layout.html 101 | [options-layoutdir]: http://assemble.io/docs/options-layoutdir.html 102 | [options-pagination]: http://assemble.io/docs/options-pagination.html 103 | [options-partials]: http://assemble.io/docs/options-partials.html 104 | [options-permalinks]: http://assemble.io/docs/options-permalinks.html 105 | [outline]: http://assemble.io/docs/Outline.html 106 | [overview]: http://assemble.io/docs/Overview.html 107 | [pages]: http://assemble.io/docs/Pages.html 108 | [partials]: http://assemble.io/docs/Partials.html 109 | [quickstart]: http://assemble.io/docs/Quickstart.html 110 | [tasks-and-targets]: http://gruntjs.com/configuring-tasks#task-configuration-and-targets 111 | [templates]: http://assemble.io/docs/Templates.html 112 | [why-assemble]: http://assemble.io/docs/Why-Assemble.html 113 | [yaml-front-matter]: http://assemble.io/docs/YAML-front-matter.html 114 | [yaml]: http://assemble.io/docs/YAML.html 115 | [yfm]: http://assemble.io/docs/YAML-front-matter.html 116 | 117 | 118 | --- 119 | _This file was generated using [Grunt.js](https://gruntjs.com) and [Assemble](https://github.com/assemble/assemble) on 07/25/2013._ -------------------------------------------------------------------------------- /dest/DOCUMENTATION.md: -------------------------------------------------------------------------------- 1 | # Assemble Docs 2 | 3 | > Visit Assemble's full documentation for more information about generating sites, documentation and components. 4 | 5 | ## [About][About] 6 | 7 | ### [Getting Started][Home] 8 | 9 | ### Configuration 10 | 11 | * [Built-In Variables][built-in-variables] 12 | * [Options][options] 13 | * [options.assets][options-assets] 14 | * [options.collections][options-collections] 15 | * [options.data][options-data] 16 | * [options.engine][options-engine] 17 | * [options.ext][options-ext] 18 | * [options.helpers][options-helpers] 19 | * [options.layout][options-layout] 20 | * [options.layoutdir][options-layoutdir] 21 | * [options.pagination][options-pagination] 22 | * [options.partials][options-partials] 23 | * [options.permalinks][options-permalinks] 24 | 25 | 26 | ### Templates 27 | 28 | * [Pages][pages] 29 | * [Layouts][layouts] 30 | * [Partials][partials] 31 | * [Helpers][Helpers] 32 | 33 | 34 | ### Data 35 | 36 | * [Data][data-types] 37 | * [JSON][json] 38 | * [YAML][yaml] 39 | * [YAML Front Matter][yaml-front-matter] 40 | 41 | 42 | ### Content 43 | 44 | * [Markdown][markdown] 45 | 46 | 47 | ### Examples 48 | 49 | * [All examples](https://github.com/assemble/assemble-examples) 50 | * [Creating a Basic Site](https://github.com/assemble/assemble-examples-basic) 51 | * [Generate a README or markdown docs](https://github.com/assemble/assemble-examples-readme) 52 | * [Create sitemap](https://github.com/assemble/assemble-examples-sitemap) 53 | 54 | 55 | ### Development 56 | 57 | * [Methods][methods] 58 | 59 | 60 | ### Other 61 | 62 | * [External Libraries][external-libraries] 63 | 64 | 65 | ## Related Projects 66 | 67 | * [assemble-init](https://github.com/assemble/assemble-init) 68 | * [assemble-less](https://github.com/assemble/assemble-less) 69 | * [assemble-manifest](https://github.com/assemble/assemble-manifest) 70 | 71 | 72 | 73 | [about]: http://assemble.io/docs/About.html 74 | [built-in-variables]: http://assemble.io/docs/Built-in-Variables.html 75 | [data-types]: http://assemble.io/docs/Data-Types.html 76 | [data]: http://assemble.io/docs/Data.html 77 | [examples]: https://github.com/assemble/assemble-examples "Assemble Examples" 78 | [extending-assemble]: http://assemble.io/docs/Extending-Assemble.html 79 | [external-libraries]: http://assemble.io/docs/External-Libraries.html 80 | [files]: http://gruntjs.com/configuring-tasks#files 81 | [handlebars]: http://handlebarsjs.com 82 | [helper-lib]: http://github.com/assemble/helper-lib "Extensive collection of Handlebars helpers" 83 | [helpers]: http://assemble.io/docs/Helpers.html 84 | [home]: http://assemble.io/docs/Home.html 85 | [index]: http://assemble.io/docs/index.html 86 | [installation]: http://assemble.io/docs/Installation.html 87 | [json]: http://assemble.io/docs/JSON.html 88 | [layouts]: http://assemble.io/docs/Layouts.html 89 | [lodash]: http://gruntjs.com/configuring-tasks#templates 90 | [markdown]: http://assemble.io/docs/Markdown.html 91 | [metadata]: http://assemble.io/docs/Metadata.html 92 | [methods]: http://assemble.io/docs/Methods.html 93 | [options]: http://assemble.io/docs/Options.html 94 | [options-assets]: http://assemble.io/docs/options-assets.html 95 | [options-collections]: http://assemble.io/docs/options-collections.html 96 | [options-data]: http://assemble.io/docs/options-data.html 97 | [options-engine]: http://assemble.io/docs/options-engine.html 98 | [options-ext]: http://assemble.io/docs/options-ext.html 99 | [options-helpers]: http://assemble.io/docs/options-helpers.html 100 | [options-layout]: http://assemble.io/docs/options-layout.html 101 | [options-layoutdir]: http://assemble.io/docs/options-layoutdir.html 102 | [options-pagination]: http://assemble.io/docs/options-pagination.html 103 | [options-partials]: http://assemble.io/docs/options-partials.html 104 | [options-permalinks]: http://assemble.io/docs/options-permalinks.html 105 | [outline]: http://assemble.io/docs/Outline.html 106 | [overview]: http://assemble.io/docs/Overview.html 107 | [pages]: http://assemble.io/docs/Pages.html 108 | [partials]: http://assemble.io/docs/Partials.html 109 | [quickstart]: http://assemble.io/docs/Quickstart.html 110 | [tasks-and-targets]: http://gruntjs.com/configuring-tasks#task-configuration-and-targets 111 | [templates]: http://assemble.io/docs/Templates.html 112 | [why-assemble]: http://assemble.io/docs/Why-Assemble.html 113 | [yaml-front-matter]: http://assemble.io/docs/YAML-front-matter.html 114 | [yaml]: http://assemble.io/docs/YAML.html 115 | [yfm]: http://assemble.io/docs/YAML-front-matter.html 116 | 117 | 118 | --- 119 | _This file was generated using [Grunt.js](https://gruntjs.com) and [Assemble](https://github.com/assemble/assemble) on 06/23/2013._ -------------------------------------------------------------------------------- /src/content/wiki/data-context.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | > In Assemble, context is the current JSON data object that templates can use. 4 | 5 | If you are unfamiliar with how Handlebar templates work, please visit the [Handlebar documentation](http://handlebarsjs.com/) for more information. Also see Assemble's wiki page for [Templates][] and [Data][]. 6 | 7 | 8 | ## Context in Handlebars 9 | In Handlebars, every template has a context. Blocks such as \{{#if}} create "inline" templates, and the "if" helper then determines in which context to render the template. 10 | 11 | Some helpers, like \{{#if}}, preserve the current context, while others such as \{{#each}} and \{{#with}} _change the context_ in different ways. _Helpers can even change the context to something totally new if they want_: 12 | 13 | ``` 14 | options.fn({ 15 | published: true 16 | }) 17 | ``` 18 | 19 | Handlebars also supports nested contexts, making it possible to look up properties nested below the current context. Nested handlebars paths can also include `../` segments, which evaluate their paths against a parent context. 20 | 21 | The `..` feature means "look this up on the context of the parent template". In some cases, that will amount to the parent in the current object (with). In other cases, it will not. In cases like if, which preserve the context, .. will happen to point to the same object, but this is just a coincidence. In all cases, `..` is lexically bound to the parent template. 22 | 23 | 24 | ## The "context" object 25 | The context object is just a [JSON data][JSON] object that when passed to the compiled template function becomes the value of this inside your template. You must use the name of the associated [data file][Data] to access properties and call helper methods on the context object. 26 | 27 | ### Example 28 | 29 | Given we have a data file `alert.json` that contains the following properties: 30 | 31 | ``` json 32 | { 33 | "title": "Heads up!" 34 | } 35 | ``` 36 | 37 | In our template `alert.hbs`, we will now look up the properites of `alert.json` by using the name of the file, `alert`, as the current context. So to retrieve the `title` property, we would do this: 38 | 39 | ``` handlebars 40 |

\{{alert.title}}

41 | ``` 42 | Which renders to: 43 | 44 | ``` html 45 |

Heads up!

46 | ``` 47 | 48 | 49 | ## Root context 50 | In Assemble, the root of the context is where the data object starts. Everything under the root is a child property. Also, when a variable is at "the root of the context" the variable may be used as-is, or "raw", enabling you to look up properties _for the "current" object_ without nesting the context _within_ the current object. In other words, the "path" of the current object does not need to be appended to the variable, so instead of `about_us.title`, you may simply use `title`. 51 | 52 | ### Example 53 | 54 | In `layout.hbs` we will use `\{{title}}` to lookup the `title` property on each page that is passed into the layout. 55 | 56 | ``` handlebars 57 | 58 | 59 | 60 | 61 | \{{title}} 62 | 63 | 64 | \{{> body }} 65 | 66 | 67 | ``` 68 | 69 | 70 | 71 | 72 | ## The "data" object 73 | When data is added directly to a file named `data.json` (or `data.yml`) it will be loaded _directly into the root of the context_ by Assemble. Note that your templates will need to be namespaced differently than if you put data into a file called `myData.json`. 74 | 75 | For example, given we have a file named `data.json` with: 76 | 77 | ```json 78 | { 79 | "title": "My Title" 80 | } 81 | ``` 82 | Inside `myTemplate.hbs`, we would use: 83 | 84 | ```handlebars 85 | \{{title}} 86 | ``` 87 | 88 | However, using the same example but with a file named `myData.json`, the data must now be accessed using the name of the file. 89 | 90 | So, given we have `myData.json` with: 91 | 92 | ```json 93 | { 94 | "title": "My Title" 95 | } 96 | ``` 97 | Out template, `myTemplate.hbs`, would have: 98 | 99 | ```handlebars 100 | \{{myData.title}} 101 | ``` 102 | 103 | 104 | 105 | ## "this" expression 106 | 107 | You can use the `this` expression in any context to refer to the current context. 108 | 109 | For example (from http://handlebarsjs.com/), inside the `\{{#each}}` block, you can use `this` to reference the element being iterated over. 110 | 111 | ``` handlebars 112 |
    113 | 114 |
115 | ``` 116 | when used with this context, `people.json`: 117 | 118 | ``` json 119 | [ 120 | "Jon Schlinkert", 121 | "Brian Woodward" 122 | ] 123 | ``` 124 | will result in: 125 | 126 | ``` html 127 |
    128 |
  • Jon Schlinkert
  • 129 |
  • Brian Woodward
  • 130 |
131 | ``` 132 | 133 | [templates]: https://github.com/assemble/assemble/wiki/Templates -------------------------------------------------------------------------------- /src/content/wiki/options-layoutdir.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## options.layoutdir 4 | 5 | > Path to the directory to be used as the "cwd" for layouts 6 | 7 | `layoutdir` makes maintaining [layouts][options-layout] a little easier on projects that require more than one layout. The primary advantage of using the feature is that you can change or rename the directory where your layouts are stored without having to update the path to each layout used throughout your project. It could also reduce some clutter in the [Gruntfile](http://gruntjs.com) and [YAML Front Matter][yaml-front-matter]. 8 | 9 | Additionally, a `layoutdir` can be defined for each [targets][targets], allowing for even greater control over how [layouts][] are used in your projects. 10 | 11 | 12 | ## Usage Examples 13 | 14 | ### Without `layoutdir` 15 | When `layoutdir` _is not defined_, each layout must be defined using the _full path from the project root to the layout_: 16 | 17 | ``` 18 | assemble: { 19 | options: { 20 | layout: 'src/templates/layouts/default-layout.hbs' 21 | }, 22 | docs: { 23 | options: { 24 | layout: 'src/templates/layouts/docs-layout.hbs' 25 | }, 26 | ... 27 | }, 28 | blog: { 29 | options: { 30 | layout: 'src/templates/layouts/blog-layout.hbs' 31 | }, 32 | ... 33 | } 34 | // etc. 35 | } 36 | ``` 37 | 38 | This also applies to [YAML front matter][yaml-front-matter] when it is necessary to "override" layouts at the page-level: 39 | 40 | ``` html 41 | --- 42 | title: Blog 43 | layout: src/templates/layouts/blog-layout.hbs 44 | --- 45 | ``` 46 | 47 | 48 | ### With `layoutdir` 49 | 50 | When `layoutdir` is defined only require the name of the layout to be used (_must include the file extension_): 51 | 52 | ``` 53 | assemble: { 54 | options: { 55 | layoutdir: 'src/templates/layouts', 56 | layout: 'default-layout.hbs' 57 | }, 58 | docs: { 59 | options: { 60 | layout: 'docs-layout.hbs' 61 | }, 62 | ... 63 | }, 64 | blog: { 65 | options: { 66 | layout: 'blog-layout.hbs' 67 | }, 68 | ... 69 | } 70 | // etc. 71 | } 72 | ``` 73 | 74 | And in [YAML front matter][yaml-front-matter]: 75 | 76 | ``` html 77 | --- 78 | title: Blog 79 | layout: blog-layout.hbs 80 | --- 81 | ``` 82 | 83 | 84 | ## A Word of Caution 85 | While `layoutdir` can make your project a little easier to manage, it is strongly recommended that you **establish clear and consistent conventions for your layouts, and follow them**. Otherwise, this feature might end up causing more problems than it solves. 86 | 87 | Here are some recommendations. 88 | 89 | * Use names such as `default-layout.hbs` versus simply `default.hbs`, and 90 | * Use a unique name for each layout used throughout a project. 91 | 92 | ### Why clear naming conventions are important 93 | 94 | To understand why this is important, imagine that you're project has three "sub-projects", or [targets][]: `components`, `docs` and `blog`, and that each target has a different layout. This is a fairly basic, common scenario. But remember that each may also have its own `layoutdir` as well, which creates potential for conventions that lead to using the wrong layout accidentally, such as this: 95 | 96 | #### Dont' do this 97 | 98 | ``` 99 | assemble: { 100 | components: { 101 | options: { 102 | layoutdir: 'src/components/layouts', 103 | layout: 'default.hbs' 104 | } 105 | ... 106 | }, 107 | docs: { 108 | options: { 109 | layoutdir: 'src/docs/layouts', 110 | layout: 'default.hbs' 111 | } 112 | ... 113 | }, 114 | blog: { 115 | options: { 116 | layoutdir: 'src/blog/layouts', 117 | layout: 'default.hbs' 118 | } 119 | ... 120 | } 121 | // etc. 122 | } 123 | ``` 124 | Note that the layout name is the same for each target, but the `layoutdir` is a different directory, indicating that there are three different "default" layouts. 125 | 126 | While it might make sense for each target to have its own `layoutdir`, since layouts can be overridden in the [YAML front matter][yaml-front-matter] of individual pages, it is not a good idea to use the same name for multiple layouts, _unless you are intentionally using this naming convention as a strategy_. The reason is that it gets very difficult to track which page is building from which layout when working inside the pages themselves. 127 | 128 | ### Difficult to follow 129 | 130 | Without `layoutdir`, you have the entire path to follow, but without it you must rely on the name of the layout itself to guide you. 131 | 132 | ``` html 133 | --- 134 | title: Any Page 135 | layout: default.hbs 136 | --- 137 | ``` 138 | 139 | ### Much better 140 | 141 | Using a more descriptive name for the layout helps avoid confusion _now_: 142 | 143 | ``` html 144 | --- 145 | title: Any Page 146 | layout: blog-default.hbs 147 | --- 148 | ``` 149 | 150 | Of course, these are only recommendations and you will need to find a strategy that works for you and your team. 151 | 152 | 153 | ## Related Info 154 | 155 | * [options.layout][options-layout] 156 | * [Layouts][] 157 | -------------------------------------------------------------------------------- /dest/DOCUMENTATION.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Assemble Docs 6 | 7 | 8 | 9 | 10 | 11 | 12 | 14 | 15 | 17 | 40 | 41 | 42 | 44 |
45 |
46 |
47 |
48 |

ASSEMBLE DOCS

49 |
50 |
51 |
52 |
53 | 54 | 55 | 57 |
58 |
59 | 60 |
61 |

Visit Assemble's full documentation for more information about generating sites, documentation and components.

62 |
63 | 64 |

About

65 |

Getting Started

66 |

Configuration

67 | 84 |

Templates

85 | 91 |

Data

92 | 100 |

Content

101 | 104 |

Examples

105 | 111 |

Development

112 | 115 |

Other

116 | 119 |

Related Projects

120 | 125 | 126 |
127 |
128 | 129 | 130 | 131 | -------------------------------------------------------------------------------- /dest/toc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Assemble Docs 6 | 7 | 8 | 9 | 10 | 11 | 12 | 14 | 15 | 17 | 40 | 41 | 42 | 44 |
45 |
46 |
47 |
48 |

ASSEMBLE DOCS

49 |
50 |
51 |
52 |
53 | 54 | 55 | 57 |
58 |
59 | 60 |
61 |

Visit Assemble's full documentation for more information about generating sites, documentation and components.

62 |
63 | 64 |

About

65 |

Getting Started

66 |

Configuration

67 | 84 |

Templates

85 | 91 |

Data

92 | 100 |

Content

101 | 104 |

Examples

105 | 111 |

Development

112 | 115 |

Other

116 | 119 |

Related Projects

120 | 125 | 126 |
127 |
128 | 129 | 130 | 131 | -------------------------------------------------------------------------------- /dest/markdown-block-1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Inline Markdown 6 | 7 | 8 | 9 | 10 | 11 | 12 | 14 | 15 | 17 | 40 | 41 | 42 | 44 |
45 |
46 |
47 |
48 |

Docs / Markdown Helpers

49 |
50 |
51 |
52 |
53 | 54 | 55 | 57 |
58 |
59 | 76 |
77 | 78 |
79 | 80 | 81 |

Inline Markdown

82 |
83 |

In this example markdown content from the README is written in between the open and close "markdown" block expressions so that it will be rendered to HTML. Handlebars templates are also embedded in the markdown for rendering the metadata from our YAML front matter.

84 |
85 |

The markdown used in this example was borrowed from Assemble's wiki. Expect to find broken links since the "complete build" for the wiki includes components that are not present in this repo.

86 |

Getting started

87 |

If you have trouble getting started, please visit the documentation at http://assemble.io, or create an Issue at Assemble's GitHub repo, we're happy to help.

88 |

This plugin requires Grunt ~0.4.1. If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

89 |
npm install assemble --save-dev
90 |

Once the plugin has been installed, it may be enabled inside your [Gruntfile][Getting Started] with this line of JavaScript:

91 |
grunt.loadNpmTasks('assemble');
92 |

The "assemble" task

93 |

In your project's Gruntfile, add a section named assemble to the data object passed into grunt.initConfig().

94 |
grunt.initConfig({
 95 |   assemble: {
 96 |     options: {
 97 |       // Task-specific options go here.
 98 |     },
 99 |     your_target: {
100 |       // Target-specific file lists and/or options go here.
101 |     }
102 |   }
103 | });
104 | grunt.loadNpmTasks('assemble');
105 | 
106 | grunt.registerTask('default', [
107 |   'jshint',
108 |   'assemble'
109 | ]);
110 |

Task targets, files and options may be specified according to the grunt Configuring tasks guide.

111 |

You should now be able to run grunt assemble to build the project.

112 |

Visit Assemble's documentation for more information.

113 |

Contributing

114 |

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [grunt][].

115 |

Release History

116 |

(Nothing yet)

117 | 118 |
119 |
120 | 121 | 122 | 123 | -------------------------------------------------------------------------------- /src/content/wiki/options-ext.md: -------------------------------------------------------------------------------- 1 | 2 | ## options.ext 3 | 4 | > Specify the file extension to use on dest files. Extensions can be specified at the task and target-levels. 5 | 6 | Type: `String` (optional) 7 | Default: `.html` 8 | 9 | 10 | ## Overview 11 | When planning out the strategy for your build targets, [templates][templates] and [data][data], don't forget to take the `ext` variable into consideration. `ext` opens up a few doors by "bending the rules" around how your source files will be compiled or rendered. 12 | 13 | In 90% of cases, the `ext` option will not be needed, and simply using the `.hbs` file extension on your [templates][templates] will suffice. However, in scenarios where you are using mixed content, say HTML and markdown with Handelbars templates embedded in one or both formats, you may need to use the `ext` option to esure that you get the output you need. 14 | 15 | ### Mixed content: Markdown and HTML together 16 | 17 | Consider the following scenario: 18 | 19 | * Your page content and/or blog posts will be written in [markdown][markdown] format 20 | * You want to embed Handlebars templates in your markdown content for certain types of metadata, such as links, date/time, etc. 21 | * Your page [layouts][layouts] are made from HTML, but they also with embedded with Handlebars templates 22 | * Your end goal is for all of your markdown content to be rendered to HTML in the output. 23 | 24 | and you want your need to compile some markdown files to HTML, and you want to use other markdown files as "includes" or "partials" inside other markdown files, in which case you want the markdown files to be rendered _as markdown_ in the output. You may even want to embed Handlebars templates inside your markdown files to be parsed and compiled. 25 | 26 | 27 | 28 | ## Extensions map 29 | 30 | ### Whitelisted extensions 31 | As of NaN/NaN/NaN NaN:NaNAM, Assemble's extensions map "whitelists" the following extensions: 32 | 33 | **Handlebars extensions** 34 | 35 | * `handlebar : handlebars` 36 | * `handlebars: handlebars` 37 | * `hb : handlebars` 38 | * `hbars : handlebars` 39 | * `hbrs : handlebars` 40 | * `hbs : handlebars` 41 | * `hbt : handlebars` 42 | * `htm : handlebars` 43 | * `html : handlebars` 44 | * `mustache : handlebars` 45 | * `template : handlebars` 46 | * `tmpl : handlebars` 47 | * `tpl : handlebars` 48 | 49 | **Markdown extensions** 50 | 51 | * `markd : markdown` 52 | * `markdown: markdown` 53 | * `md : markdown` 54 | 55 | 56 | ### Forcing non-whitelisted extensions 57 | 58 | If you need Assemble to process templates in files with an extension that isn't in [extensions.yml](https://github.com/assemble/assemble/blob/master/lib/engine/extensions.yml), you must _explicitly define the template engine in the task/target options to force Assemble to process your templates._ 59 | 60 | So given this example: 61 | 62 | ``` js 63 | assemble: { 64 | options: { 65 | engine: "Handlebars" // case insensitive 66 | }, 67 | files: { 68 | 'dist/': ['src/pages/*.snickerdoodle'] 69 | } 70 | } 71 | ``` 72 | So now that we have defined an engine, Handlebars, Assemble knows to use that engine to process templates with the `.snickerdoodle` extension. Even better, your templates will also be compiled into delicious Christmas cookies with cinnamon and sugar sprinkled on top. 73 | 74 | 75 | 76 | ## Example usage 77 | Here are some examples that cover common use cases. 78 | 79 | 80 | ### Markdown-to-markdown 81 | If your repo is on GitHub, it's a safe bet you're using markdown format on your READMEs and wikis. Here we're going to show you how to use templates to generate markdown files, so if you work on big projects, or a lot of projects, you can potentially reduce the amount of time you spend updating documentation, changelogs, links, common metadata and so on. 82 | 83 | Now, of course there are many ways to accomplish the same goal, this is an example so we're going for simplicity. Here's what we want to accomplish: 84 | 85 | * `src` content _written_ in markdown 86 | * `src` content contains templates, 87 | * Metadata for templates must come from a single source, say `package.json` (this is arbitrary, you can use more than one file if you want, `.yml` format is fine too) 88 | * generated `dest` files must remain in markdown format. In other words, we want Assemble to process the templates, but not to convert the markdown to HTML. 89 | 90 | Here is what we need to do: 91 | 92 | Example configuration: 93 | 94 | ``` js 95 | assemble: { 96 | options: { 97 | data: 'src/data/readme.yml', 98 | partials: 'src/content/*.hbs', 99 | ext: '' // add the "empty" ext property 100 | }, 101 | readme: { 102 | files: { 103 | './': ['src/templates/README.md.hbs'] 104 | } 105 | } 106 | } 107 | ``` 108 | 109 | Our goal here is to tell the `assemble` task to treat the `src` markdown files as regular content. In other words we don't want the task to convert the markdown files to HTML, so we use a sort of trick that allows us to write our README content in markdown along with embedded Handlebars templates. 110 | 111 | Our goal here is to tell the `assemble` task. 112 | 113 | Here, we tell the `assemble` task not to use an extension on `dest` files by leaving `ext: ''` blank. We do this because our templates have the extenions `.md.hbs` and assemble only slices off the last extension at build time. So by 1) telling assemble not to add another extension to the rendered templates, and 2) by naming our template files with the `.md.hbs` extension, we 114 | 115 | 116 | ### markdown-to-HTML 117 | 118 | Common use cases: 119 | 120 | * Blog posts written in markdown, converted to HTML for a live site. 121 | * gh-pages documentation 122 | 123 | ``` js 124 | assemble: { 125 | options: { 126 | engine: "Handlebars" // case insensitive 127 | }, 128 | files: { 129 | 'dist/': ['src/pages/*.md.hbs'] 130 | } 131 | } 132 | ``` 133 | Rendered pages will have the `.html` extension by default. 134 | 135 | 136 | 137 | [extensions.yml]: https://github.com/assemble/assemble/blob/master/lib/engine/extensions.yml "Valid extensions in Assemble" -------------------------------------------------------------------------------- /src/content/wiki/templates-layouts.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | > Layouts are used for "wrapping" the content of individual pages with common HTNL, such as a "header" and "footer". 4 | 5 | 6 | ## Layout example 7 | 8 | Layouts are optional, but the `\{{> body }}` tag is required for content to be pulled into a layout. 9 | 10 | ```html 11 | 12 | 13 | 14 | \{{title}} 15 | 16 | 17 | 18 | \{{> body }} 19 | 20 | 21 | ``` 22 | 23 | 24 | ## Granular control 25 | 26 | 1. **Task options**: Great for defining a "project-wide" default. 27 | 2. **Target options**: Override the "project default" in the `options` for each target. Offers greater control over which "types" of pages get which `layout`. 28 | 3. **Page-by-page**: If you require more granularity you can define a layout in the [YFM][yaml-front-matter] of a page 29 | 30 | 31 | 32 | 33 | ### Multiple layouts 34 | 35 | Since you can create as many [targets][] as you require, defining layouts in the Gruntfile is a great way of quickly setting up your layout "defaults". In the `assemble` task in your Gruntfile.js, you can define a layout at the task-level, and/or a different layout for each build target: 36 | 37 | ``` javscript 38 | assemble: { 39 | options: { 40 | layout: 'layouts/default.hbs' 41 | }, 42 | site: { 43 | files: { 44 | 'site/': ['templates/pages/*.hbs'] 45 | } 46 | }, 47 | blog: { 48 | options: { 49 | layout: 'layout/post.hbs' 50 | }, 51 | files: { 52 | 'blog/': ['templates/posts/*.hbs'] 53 | } 54 | }, 55 | docs: { 56 | options: { 57 | layout: 'layouts/docs.hbs' 58 | }, 59 | files: { 60 | 'docs/': ['templates/docs/*.hbs'] 61 | } 62 | } 63 | } 64 | ``` 65 | 66 | ## Page-specific Layouts 67 | 68 | If you require a higher level of granularity than defining layouts in the Gruntfile, you may also define layouts on a page-by-page basis, thus overriding both the task-level ("global") defaults and the target-level defaults. 69 | 70 | To do so, just add the layout to the [YFM][yaml-front-matter] of the page like this: 71 | 72 | ``` yaml 73 | --- 74 | layout: path/to/layout.hbs 75 | --- 76 | ``` 77 | 78 | ## Disabling Layouts 79 | 80 | * **Pages**: add `layout: false` to the YAML front matter of any page that should build without a layout. 81 | * **Targets**: add `layout: false` to the options of any target that should build pages without a layout. 82 | 83 | 84 | ## Example usage 85 | Your imagination is the only limit to what can be done with layouts, so these are just examples. 86 | 87 | 88 | ### Basic layout 89 | This is something you might use to wrap basic pages for a demo, documentation, etc. 90 | 91 | ```html 92 | 93 | 94 | 95 | \{{title}} 96 | 97 | 98 | 102 | 103 | \{{> body }} 104 | 105 | 106 | ``` 107 | 108 | ### Advanced layout 109 | 110 | ``` html 111 | 112 | 113 | 114 | \{{page.title}} · \{{ site.title }} 115 | 116 | 117 | \{{> head-extras }} 118 | 119 | 120 | 121 | 122 | 123 | 124 | 147 | 148 | 149 |
150 | \{{> body }} 151 |
152 | 153 | 154 |
155 | \{{> footer }} 156 |
157 | 158 | 159 | 160 | ``` 161 | 162 | ### Markdown layout 163 | 164 | Layouts don't have to be HTML, they can be whatever language you want them to be. If you're generating markdown pages instead of HTML, maybe for a project wiki or other markdown documentation, then you'll want to use a markdown formatted `layout`. 165 | 166 | In this example, instead of adding adding the traditional head and footer we'll add some link references to make sure the same ones are used on every generated page. This makes it easier to maintain links and it also cuts down on potential for broken links: 167 | 168 | ``` markdown 169 | \{{> body }} 170 | 171 | --- 172 | 173 | _This page was generated using Grunt and [assemble][repo] on \{{ today }}._ 174 | 175 | [org]: https://github.com/assemble 176 | [repo]: https://github.com/assemble/assemble 177 | [issues]: https://github.com/assemble/assemble/issues 178 | [wiki]: https://github.com/assemble/assemble/wiki 179 | ``` 180 | 181 | ## Layout FAQ 182 | * Layouts are optional 183 | * When a layout is specified, _it must include a `\{{> body }}` tag to render content_ from any file that uses the layout. 184 | * Layouts may be defined in the Gruntfile or in [YFM][yaml-front-matter] of a page. 185 | * A layout defined for a target will override a layout defined at the task level. 186 | * A layout defined in [YFM][yaml-front-matter] will override a layout defined in the Gruntfile 187 | * [Lo-dash templates][templates] can be used in YAML front-matter ayout. Path, file name and extension can be determined 188 | 189 | 190 | ## Related info 191 | * [options.layout][options-layout] 192 | * [Pages][pages] 193 | * [Partials][partials] 194 | * [Templates][templates] 195 | * [YFM][yaml-front-matter] 196 | 197 | 198 | -------------------------------------------------------------------------------- /dest/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Home 6 | 7 | 8 | 9 | 10 | 11 | 12 | 14 | 15 | 17 | 40 | 41 | 42 | 44 |
45 |
46 |
47 |
48 |

Docs / Markdown

49 |
50 |
51 |
52 |
53 | 54 | 55 | 57 |
58 |
59 | 76 |
77 | 78 |
79 | 80 |

Markdown Boilerplate

81 |
82 |

Use Assemble to generate HTML pages from markdown content. Useful for wikis, gh-pages, documentation and blogs or sites with markdown posts.

83 |
84 |

Thank you to Upstage for the theme used in the live demo (the same used on http://assemble.io)!

85 |

This is not intended to be "documentation" for Assemble, the content used in this project is for example purposes. So you will learn by browsing the source code, rendered code, and seeing how it renders in the browser.

86 |

Related information

87 | 92 |

What you'll see in the examples

93 |
    94 |
  • How to use file globbing to include multiple markdown files based on specified patterns.
  • 95 |
96 |

Rendering markdown to markdown

97 |
    98 |
  • How to generate markdown files from markdown pages. See ../src/content/TOC.md
  • 99 |
  • How to use markdown "includes" that either render to HTML or render as markdown
  • 100 |
  • How to use markdown layouts for generating markdown files
  • 101 |
102 |

Rendering markdown to HTML

103 |
    104 |
  • How to write markdown "inline" with HTML and have it render to HTML
  • 105 |
  • How to generate HTML files from markdown pages, layouts and content.
  • 106 |
107 |

Getting started

108 |

If you have trouble getting started, please visit the documentation at http://assemble.io, or create an Issue at Assemble's GitHub repo, we're happy to help.

109 |

This plugin requires Grunt ~0.4.1. If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

110 |
npm install assemble --save-dev
111 |

Once the plugin has been installed, it may be enabled inside your [Gruntfile][Getting Started] with this line of JavaScript:

112 |
grunt.loadNpmTasks('assemble');
113 |

The "assemble" task

114 |

In your project's Gruntfile, add a section named assemble to the data object passed into grunt.initConfig().

115 |
grunt.initConfig({
116 |   assemble: {
117 |     options: {
118 |       // Task-specific options go here.
119 |     },
120 |     your_target: {
121 |       // Target-specific file lists and/or options go here.
122 |     }
123 |   }
124 | });
125 | grunt.loadNpmTasks('assemble');
126 | 
127 | grunt.registerTask('default', [
128 |   'jshint',
129 |   'assemble'
130 | ]);
131 |

Task targets, files and options may be specified according to the grunt Configuring tasks guide.

132 |

You should now be able to run grunt assemble to build the project.

133 |

Visit Assemble's documentation for more information.

134 |

Contributing

135 |

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [grunt][].

136 |

Release History

137 |

(Nothing yet)

138 | 139 | 140 | 141 | 142 |
143 |
144 | 145 | 146 | 147 | -------------------------------------------------------------------------------- /dest/markdown-block-2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Markdown "Includes" 6 | 7 | 8 | 9 | 10 | 11 | 12 | 14 | 15 | 17 | 40 | 41 | 42 | 44 |
45 |
46 |
47 |
48 |

Docs / Markdown Helpers

49 |
50 |
51 |
52 |
53 | 54 | 55 | 57 |
58 |
59 | 76 |
77 | 78 |
79 | 80 |

Markdown "Includes"

81 |
82 |

In this example we're doing the same thing as in "three.hbs" but we're using the "include" helper to pull in content from an external file rather than writing it inline.

83 |
84 |
85 |

Markdown Boilerplate

86 |
87 |

Use Assemble to generate HTML pages from markdown content. Useful for wikis, gh-pages, documentation and blogs or sites with markdown posts.

88 |
89 |

Thank you to Upstage for the theme used in the live demo (the same used on http://assemble.io)!

90 |

This is not intended to be "documentation" for Assemble, the content used in this project is for example purposes. So you will learn by browsing the source code, rendered code, and seeing how it renders in the browser.

91 |

Related information

92 | 97 |

What you'll see in the examples

98 |
    99 |
  • How to use file globbing to include multiple markdown files based on specified patterns.
  • 100 |
101 |

Rendering markdown to markdown

102 |
    103 |
  • How to generate markdown files from markdown pages. See ../src/content/TOC.md
  • 104 |
  • How to use markdown "includes" that either render to HTML or render as markdown
  • 105 |
  • How to use markdown layouts for generating markdown files
  • 106 |
107 |

Rendering markdown to HTML

108 |
    109 |
  • How to write markdown "inline" with HTML and have it render to HTML
  • 110 |
  • How to generate HTML files from markdown pages, layouts and content.
  • 111 |
112 |

Getting started

113 |

If you have trouble getting started, please visit the documentation at http://assemble.io, or create an Issue at Assemble's GitHub repo, we're happy to help.

114 |

This plugin requires Grunt ~0.4.1. If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

115 |
npm install assemble --save-dev
116 |

Once the plugin has been installed, it may be enabled inside your [Gruntfile][Getting Started] with this line of JavaScript:

117 |
grunt.loadNpmTasks('assemble');
118 |

The "assemble" task

119 |

In your project's Gruntfile, add a section named assemble to the data object passed into grunt.initConfig().

120 |
grunt.initConfig({
121 |   assemble: {
122 |     options: {
123 |       // Task-specific options go here.
124 |     },
125 |     your_target: {
126 |       // Target-specific file lists and/or options go here.
127 |     }
128 |   }
129 | });
130 | grunt.loadNpmTasks('assemble');
131 | 
132 | grunt.registerTask('default', [
133 |   'jshint',
134 |   'assemble'
135 | ]);
136 |

Task targets, files and options may be specified according to the grunt Configuring tasks guide.

137 |

You should now be able to run grunt assemble to build the project.

138 |

Visit Assemble's documentation for more information.

139 |

Contributing

140 |

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [grunt][].

141 |

Release History

142 |

(Nothing yet)

143 | 144 |
145 |
146 | 147 | 148 | 149 | -------------------------------------------------------------------------------- /dest/render-readme.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Markdown "Includes" 6 | 7 | 8 | 9 | 10 | 11 | 12 | 14 | 15 | 17 | 40 | 41 | 42 | 44 |
45 |
46 |
47 |
48 |

Docs / Markdown Helpers

49 |
50 |
51 |
52 |
53 | 54 | 55 | 57 |
58 |
59 | 76 |
77 | 78 |
79 | 80 |

Markdown "Includes"

81 |
82 |

In this example we're doing the same thing as in "three.hbs" but we're using the "include" helper to pull in content from an external file rather than writing it inline.

83 |
84 |
85 |

Markdown Boilerplate

86 |
87 |

Use Assemble to generate HTML pages from markdown content. Useful for wikis, gh-pages, documentation and blogs or sites with markdown posts.

88 |
89 |

Thank you to Upstage for the theme used in the live demo (the same used on http://assemble.io)!

90 |

This is not intended to be "documentation" for Assemble, the content used in this project is for example purposes. So you will learn by browsing the source code, rendered code, and seeing how it renders in the browser.

91 |

Related information

92 | 97 |

What you'll see in the examples

98 |
    99 |
  • How to use file globbing to include multiple markdown files based on specified patterns.
  • 100 |
101 |

Rendering markdown to markdown

102 |
    103 |
  • How to generate markdown files from markdown pages. See ../src/content/TOC.md
  • 104 |
  • How to use markdown "includes" that either render to HTML or render as markdown
  • 105 |
  • How to use markdown layouts for generating markdown files
  • 106 |
107 |

Rendering markdown to HTML

108 |
    109 |
  • How to write markdown "inline" with HTML and have it render to HTML
  • 110 |
  • How to generate HTML files from markdown pages, layouts and content.
  • 111 |
112 |

Getting started

113 |

If you have trouble getting started, please visit the documentation at http://assemble.io, or create an Issue at Assemble's GitHub repo, we're happy to help.

114 |

This plugin requires Grunt ~0.4.1. If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

115 |
npm install assemble --save-dev
116 |

Once the plugin has been installed, it may be enabled inside your [Gruntfile][Getting Started] with this line of JavaScript:

117 |
grunt.loadNpmTasks('assemble');
118 |

The "assemble" task

119 |

In your project's Gruntfile, add a section named assemble to the data object passed into grunt.initConfig().

120 |
grunt.initConfig({
121 |   assemble: {
122 |     options: {
123 |       // Task-specific options go here.
124 |     },
125 |     your_target: {
126 |       // Target-specific file lists and/or options go here.
127 |     }
128 |   }
129 | });
130 | grunt.loadNpmTasks('assemble');
131 | 
132 | grunt.registerTask('default', [
133 |   'jshint',
134 |   'assemble'
135 | ]);
136 |

Task targets, files and options may be specified according to the grunt Configuring tasks guide.

137 |

You should now be able to run grunt assemble to build the project.

138 |

Visit Assemble's documentation for more information.

139 |

Contributing

140 |

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [grunt][].

141 |

Release History

142 |

(Nothing yet)

143 | 144 | 145 | 161 |
162 |
163 | 164 | 165 | 166 | -------------------------------------------------------------------------------- /src/content/wiki/options.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | > Comprehensive list of options available in Assemble 4 | 5 | Most options are defined in the `assemble` task or target options in the Gruntfile, some options may only be defined inside the [YAML front matter][yaml-front-matter] of a file, and some may be defined in either location. 6 | 7 | Additionally, options may be defined in "external" [JSON][] or [YAML][] configuration files. 8 | 9 | For the purposes of clarity, we will refer to options that are defined in the Gruntfile as "configuration" options, and options that are defined in the YFM as "page" options. 10 | 11 | 12 | ## Configuration options 13 | 14 | These options are defined in the `assemble` task in your project's Gruntfile. Any option may be defined at the [task or target][tasks-and-targets] level. 15 | 16 | | Option | Description | 17 | | -------- | ----------- | 18 | | [assets][options-assets] | directory that contains commonly used "assets" for a project, such as images, fonts, javascripts and stylesheets. Assemble will generate a relative path from dest files to the given `assets` directory. | 19 | | [collections][options-collections] | | 20 | | [data][options-data] | path to data files to supply the data that will be passed into templates. | 21 | | [engine][options-engine] | engine to be used for processing templates. Handlebars is the default. | 22 | | [ext][options-ext] | extension to be used for `dest` files. | 23 | | [helpers][options-helpers] | path to custom helper(s) to be registered and used by the current template engine. Handlebars is the default. | 24 | | [layout][options-layout]** * ** | [Layouts][] are optional and assemble will build [pages][] without one. However, when a layout is specified the file _must contain a `\{{> body }}`_ tag, since this tag indicates where the content from each file in a target should be inserted. | 25 | | [layoutdir][options-layoutdir]** * ** | [Layouts][] are optional and assemble will build [pages][] without one. However, when a layout is specified the file _must contain a `\{{> body }}`_ tag, since this tag indicates where the content from each file in a target should be inserted. | 26 | | [partials][options-partials] | the partials or "includes" to be used with [pages][]. | 27 | 28 | ***Note** that when a layout is used the [\{{> body }}][Layouts] tag must be included inside the layout in order for content from pages to be "pulled in". 29 | 30 | 31 | ## Task Options 32 | 33 | These options are defined in the `assemble` task in your Gruntfile. 34 | 35 | ### [options.data][options-data] 36 | Type: `String|Array` (optional) 37 | Default: `src/data` 38 | 39 | Retrieves data from any specified `JSON` and/or `YAML` files to populate the templates when rendered. Data gets passed through the `data` object to the options on the assemble task, and then to the context in your templates. Also useful for specifying [configuration][] data. 40 | 41 | ``` js 42 | options: { data: 'src/data/**/*.{json,yml}' } 43 | ``` 44 | 45 | Note that `assemble` merges the task and target-level data for `options.data`. 46 | 47 | ### [options.layout][options-layout] 48 | Type: `String` (optional) 49 | Default: `undefined` 50 | 51 | Layouts are optional and may be defined at the task and/or [target][tasks-and-targets] level. _Unlike Jekyll_, Assemble requires a file extension since you are not limited to using a single file type. 52 | 53 | 54 | ``` js 55 | options: { layout: 'src/layouts/default.hbs' } 56 | ``` 57 | 58 | ### [options.assets][options-assets] 59 | Type: `String` (optional) 60 | Default: `undefined` 61 | 62 | Path to the "assets" or "public" directory that will be used by dest files. Assemble uses path in the `assets` option to generate a relative path from dest files to the given "assets" directory. The "assets" folder commonly contains the CSS, JavaScripts, images and other similar files for a project. The `assets` option may be defined at the task or target-level. 63 | 64 | ``` js 65 | options: { assets: 'docs/assets' } 66 | ``` 67 | 68 | ### [options.partials][options-partials] 69 | Type: `String|Array` (optional) 70 | Default: `undefined` 71 | 72 | Specifies the Handlebars partials files, or paths to the directories of files to be used. 73 | 74 | ``` js 75 | options: { partials: 'src/partials/**/*.hbs' } 76 | ``` 77 | Note that `assemble` merges the task and target-level data for `options.partials`. 78 | 79 | 80 | ### [options.ext][options-ext] 81 | Type: `String` (optional) 82 | Default: `.html` 83 | 84 | Specify the file extension to be used for destination files. For example: 85 | 86 | ``` js 87 | assemble: { 88 | // Build sitemap from JSON and templates 89 | sitemap: { 90 | options: { ext: '.xml'}, 91 | files: { 92 | '.': ['path/to/sitemap.tmpl'] 93 | } 94 | }, 95 | // Build README from YAML and templates 96 | readme: { 97 | options: { ext: '.md' }, 98 | files: { 99 | '.': ['path/to/readme.tmpl'] 100 | } 101 | } 102 | } 103 | ``` 104 | 105 | Learn more about the [ext option][options-ext]. 106 | 107 | 108 | ### [options.engine][options-engine] 109 | Type: `String` (optional) 110 | Default: `handlebars` 111 | 112 | The engine to use for processing client-side templates. Assemble ships Handlebars as the default template engine, to learn more about adding other template engines please read the documentation on [assemble methods][methods]. 113 | 114 | Also, we welcome pull requests for additional template engines. If you have questions please create an [Issue][assemble-issues]. 115 | 116 | 117 | ### [options.helpers][options-helpers] 118 | Type: `String|Array` (optional) 119 | Default: 100+ helpers from [helper-lib][] 120 | 121 | Assemble depends on [helper-lib][], an external library which includes more than **100 Handlebars helpers**. So any helpers from that project may be used in your templates. 122 | 123 | If you wish for Assemble to use custom helpers with Handlebars or any specified template engine, just provide the path to the helper or helpers in `options.helpers` : 124 | 125 | ``` js 126 | options: { helpers: 'your/custom/helpers' } 127 | ``` 128 | 129 | ### options.removeHbsWhitespace 130 | Type: `Boolean` 131 | Default: `false` 132 | 133 | Remove extraneous whitespace added by Handlebars in rendered files. _Use at your own risk, this is an experimental option and may be removed._ 134 | 135 | 136 | 137 | ## [YAML Front-Matter Options][yaml-front-matter] 138 | These options are defined in the [YAML front matter][yaml-front-matter] of a page. 139 | 140 | ### [options.layout][options-layout] 141 | type: `string` 142 | default: `undefined` 143 | 144 | Specifies the [layout][Layouts] file to be used. Layouts defined in [YFM][yaml-front-matter] will override layouts defined in the Gruntfile. 145 | 146 | ### options.published 147 | type: `boolean` 148 | default: true 149 | 150 | Defining `published: false` in the [YAML front matter][yaml-front-matter] of a page will: 151 | 152 | * Prevent the page from rendering 153 | * Omit the page from the `pages` collection. 154 | 155 | 156 | ## Custom Options 157 | Custom, user-defined variables may be specified in the [Options][options-overview] of the assemble task or target. Any variables defined in the options will be added to the _root of the data context_ and thus they will also be available in any templates. 158 | 159 | ### Example usage 160 | A common use case for defining custom variables in the options is for easily including or excluding content based on current "development status". 161 | 162 | For example, assuming we have defined a custom option, `production`: 163 | 164 | ``` js 165 | assemble: { 166 | options: { 167 | production: false 168 | }, 169 | files: { 170 | 'site/': ['src/pages/*.hbs'] 171 | } 172 | } 173 | ``` 174 | And we add the `production` variable to our templates: 175 | 176 | ``` html 177 | \{{#if production}} 178 | 179 | \{{else}} 180 | 181 | \{{/if}} 182 | ``` 183 | Since `production: false` is defined in the Assemble [task options][options], the following HTML will be rendered with the _non-minified_ version of the script: 184 | 185 | ``` html 186 | 187 | ``` 188 | 189 | 190 | ## [Grunt.js][tasks-and-targets] Options 191 | The following is just a handful of options that can be used in your Gruntfile. Please visit the [Grunt documentation](http://gruntjs.com/api/grunt.file) to learn more. 192 | 193 | * `expand` Set to `true` to enable the following options: 194 | * `cwd` All `src` matches are relative to (but don't include) this path. 195 | * `src` Pattern(s) to match, relative to the `cwd`. 196 | * `dest` Destination path prefix. 197 | * `ext` Replace any existing extension with this value in generated `dest` paths. 198 | * `flatten` Remove all path parts from generated `dest` paths. 199 | * `rename` This function is called for each matched `src` file, (after extension renaming and flattening). The `dest` and matched `src` path are passed in, and this function must return a new `dest` value. If the same `dest` is returned more than once, each `src` which used it will be added to an array of sources for it. 200 | 201 | 202 | 203 | 204 | 205 | ## Related info: 206 | 207 | * [Variables][built-in-variables] 208 | 209 | * [YAML Options][YAML] 210 | 211 | [tasks-and-targets]: http://gruntjs.com/configuring-tasks#task-configuration-and-targets 212 | -------------------------------------------------------------------------------- /src/content/markdown/markdown-documentation-basics.md: -------------------------------------------------------------------------------- 1 | Markdown: Basics 2 | ================ 3 | 4 | 11 | 12 | 13 | Getting the Gist of Markdown's Formatting Syntax 14 | ------------------------------------------------ 15 | 16 | This page offers a brief overview of what it's like to use Markdown. 17 | The [syntax page] [s] provides complete, detailed documentation for 18 | every feature, but Markdown should be very easy to pick up simply by 19 | looking at a few examples of it in action. The examples on this page 20 | are written in a before/after style, showing example syntax and the 21 | HTML output produced by Markdown. 22 | 23 | It's also helpful to simply try Markdown out; the [Dingus] [d] is a 24 | web application that allows you type your own Markdown-formatted text 25 | and translate it to XHTML. 26 | 27 | **Note:** This document is itself written using Markdown; you 28 | can [see the source for it by adding '.text' to the URL] [src]. 29 | 30 | [s]: /projects/markdown/syntax "Markdown Syntax" 31 | [d]: /projects/markdown/dingus "Markdown Dingus" 32 | [src]: /projects/markdown/basics.text 33 | 34 | 35 | ## Paragraphs, Headers, Blockquotes ## 36 | 37 | A paragraph is simply one or more consecutive lines of text, separated 38 | by one or more blank lines. (A blank line is any line that looks like a 39 | blank line -- a line containing nothing spaces or tabs is considered 40 | blank.) Normal paragraphs should not be intended with spaces or tabs. 41 | 42 | Markdown offers two styles of headers: *Setext* and *atx*. 43 | Setext-style headers for `

` and `

` are created by 44 | "underlining" with equal signs (`=`) and hyphens (`-`), respectively. 45 | To create an atx-style header, you put 1-6 hash marks (`#`) at the 46 | beginning of the line -- the number of hashes equals the resulting 47 | HTML header level. 48 | 49 | Blockquotes are indicated using email-style '`>`' angle brackets. 50 | 51 | Markdown: 52 | 53 | A First Level Header 54 | ==================== 55 | 56 | A Second Level Header 57 | --------------------- 58 | 59 | Now is the time for all good men to come to 60 | the aid of their country. This is just a 61 | regular paragraph. 62 | 63 | The quick brown fox jumped over the lazy 64 | dog's back. 65 | 66 | ### Header 3 67 | 68 | > This is a blockquote. 69 | > 70 | > This is the second paragraph in the blockquote. 71 | > 72 | > ## This is an H2 in a blockquote 73 | 74 | 75 | Output: 76 | 77 |

A First Level Header

78 | 79 |

A Second Level Header

80 | 81 |

Now is the time for all good men to come to 82 | the aid of their country. This is just a 83 | regular paragraph.

84 | 85 |

The quick brown fox jumped over the lazy 86 | dog's back.

87 | 88 |

Header 3

89 | 90 |
91 |

This is a blockquote.

92 | 93 |

This is the second paragraph in the blockquote.

94 | 95 |

This is an H2 in a blockquote

96 |
97 | 98 | 99 | 100 | ### Phrase Emphasis ### 101 | 102 | Markdown uses asterisks and underscores to indicate spans of emphasis. 103 | 104 | Markdown: 105 | 106 | Some of these words *are emphasized*. 107 | Some of these words _are emphasized also_. 108 | 109 | Use two asterisks for **strong emphasis**. 110 | Or, if you prefer, __use two underscores instead__. 111 | 112 | Output: 113 | 114 |

Some of these words are emphasized. 115 | Some of these words are emphasized also.

116 | 117 |

Use two asterisks for strong emphasis. 118 | Or, if you prefer, use two underscores instead.

119 | 120 | 121 | 122 | ## Lists ## 123 | 124 | Unordered (bulleted) lists use asterisks, pluses, and hyphens (`*`, 125 | `+`, and `-`) as list markers. These three markers are 126 | interchangable; this: 127 | 128 | * Candy. 129 | * Gum. 130 | * Booze. 131 | 132 | this: 133 | 134 | + Candy. 135 | + Gum. 136 | + Booze. 137 | 138 | and this: 139 | 140 | - Candy. 141 | - Gum. 142 | - Booze. 143 | 144 | all produce the same output: 145 | 146 |
    147 |
  • Candy.
  • 148 |
  • Gum.
  • 149 |
  • Booze.
  • 150 |
151 | 152 | Ordered (numbered) lists use regular numbers, followed by periods, as 153 | list markers: 154 | 155 | 1. Red 156 | 2. Green 157 | 3. Blue 158 | 159 | Output: 160 | 161 |
    162 |
  1. Red
  2. 163 |
  3. Green
  4. 164 |
  5. Blue
  6. 165 |
166 | 167 | If you put blank lines between items, you'll get `

` tags for the 168 | list item text. You can create multi-paragraph list items by indenting 169 | the paragraphs by 4 spaces or 1 tab: 170 | 171 | * A list item. 172 | 173 | With multiple paragraphs. 174 | 175 | * Another item in the list. 176 | 177 | Output: 178 | 179 |

    180 |
  • A list item.

    181 |

    With multiple paragraphs.

  • 182 |
  • Another item in the list.

  • 183 |
184 | 185 | 186 | 187 | ### Links ### 188 | 189 | Markdown supports two styles for creating links: *inline* and 190 | *reference*. With both styles, you use square brackets to delimit the 191 | text you want to turn into a link. 192 | 193 | Inline-style links use parentheses immediately after the link text. 194 | For example: 195 | 196 | This is an [example link](http://example.com/). 197 | 198 | Output: 199 | 200 |

This is an 201 | example link.

202 | 203 | Optionally, you may include a title attribute in the parentheses: 204 | 205 | This is an [example link](http://example.com/ "With a Title"). 206 | 207 | Output: 208 | 209 |

This is an 210 | example link.

211 | 212 | Reference-style links allow you to refer to your links by names, which 213 | you define elsewhere in your document: 214 | 215 | I get 10 times more traffic from [Google][1] than from 216 | [Yahoo][2] or [MSN][3]. 217 | 218 | [1]: http://google.com/ "Google" 219 | [2]: http://search.yahoo.com/ "Yahoo Search" 220 | [3]: http://search.msn.com/ "MSN Search" 221 | 222 | Output: 223 | 224 |

I get 10 times more traffic from Google than from Yahoo or MSN.

228 | 229 | The title attribute is optional. Link names may contain letters, 230 | numbers and spaces, but are *not* case sensitive: 231 | 232 | I start my morning with a cup of coffee and 233 | [The New York Times][NY Times]. 234 | 235 | [ny times]: http://www.nytimes.com/ 236 | 237 | Output: 238 | 239 |

I start my morning with a cup of coffee and 240 | The New York Times.

241 | 242 | 243 | ### Images ### 244 | 245 | Image syntax is very much like link syntax. 246 | 247 | Inline (titles are optional): 248 | 249 | ![alt text](/path/to/img.jpg "Title") 250 | 251 | Reference-style: 252 | 253 | ![alt text][id] 254 | 255 | [id]: /path/to/img.jpg "Title" 256 | 257 | Both of the above examples produce the same output: 258 | 259 | alt text 260 | 261 | 262 | 263 | ### Code ### 264 | 265 | In a regular paragraph, you can create code span by wrapping text in 266 | backtick quotes. Any ampersands (`&`) and angle brackets (`<` or 267 | `>`) will automatically be translated into HTML entities. This makes 268 | it easy to use Markdown to write about HTML example code: 269 | 270 | I strongly recommend against using any `` tags. 271 | 272 | I wish SmartyPants used named entities like `—` 273 | instead of decimal-encoded entites like `—`. 274 | 275 | Output: 276 | 277 |

I strongly recommend against using any 278 | <blink> tags.

279 | 280 |

I wish SmartyPants used named entities like 281 | &mdash; instead of decimal-encoded 282 | entites like &#8212;.

283 | 284 | 285 | To specify an entire block of pre-formatted code, indent every line of 286 | the block by 4 spaces or 1 tab. Just like with code spans, `&`, `<`, 287 | and `>` characters will be escaped automatically. 288 | 289 | Markdown: 290 | 291 | If you want your page to validate under XHTML 1.0 Strict, 292 | you've got to put paragraph tags in your blockquotes: 293 | 294 |
295 |

For example.

296 |
297 | 298 | Output: 299 | 300 |

If you want your page to validate under XHTML 1.0 Strict, 301 | you've got to put paragraph tags in your blockquotes:

302 | 303 |
<blockquote>
304 |         <p>For example.</p>
305 |     </blockquote>
306 |     
307 | -------------------------------------------------------------------------------- /src/content/wiki/data-yaml-front-matter.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | > YFM is an **optional** section of valid YAML that is placed at the top of a page and is used for maintaining metadata for the page and its contents. 4 | 5 | **Actually**, YFM can be used with both [pages][pages] and [partials][partials], so _unless otherwise noted_ you can safely assume that when the documentation YFM of a page, the same applies for YFM of a partial. 6 | 7 | 8 | ## Table of Contents 9 | 10 | * YFM in "pages" (a "page" is any file specified in the `src` property of a task or target) 11 | * YFM in partials 12 | * Metadata 13 | * Content 14 | * Config data 15 | * Lo-Dash templates in YFM 16 | 17 | 18 | TOPICS TO COVER 19 | * structured data for the file and/or its contents 20 | * supply metadata 21 | * define configuration settings, options 22 | * specify variables, built-in or custom 23 | * use lo-dash templates to bring the power of JavaScript to your YFM 24 | 25 | Use cases: 26 | * collections 27 | * permalinks 28 | * lo-dash templates: time, date, metadata "pipeline" 29 | 30 | 31 | ## YFM "Variables" 32 | 33 | ### Built-in Variables 34 | 35 | * `layout` : Optionally define or override the layout to use. You must include file extension, since Assemble can process multiple file types. Layout files can exist in any directory, and may be. 36 | * `published` : set to `false` to exclude a file from being rendered by a task-target. 37 | * `category`/`categories`/`tags` : Define the categories and tags as [YAML lists](http://en.wikipedia.org/wiki/YAML#Lists or a space-separated string) or a space-separated string. for each category and tag, Assemble will generate a page in the `dest` directory. 38 | 39 | If set, allows to specify tags attributed to given entry. Tag pages are generated automatically. Entry may belong to more than one tag, use YAML List to specify multiple tags. 40 | 41 | ### Custom Variables 42 | 43 | Any variables in the front-matter that are not predefined are mixed into the data that is sent to the Liquid templating engine during the conversion. For instance, if you set a title, you can use that in your layout to set the page title: 44 | 45 | ``` html 46 | \{{ page.title }} 47 | ``` 48 | 49 | 50 | ## Using Lo-Dash templates in YFM 51 | 52 | ### Metadata "conduit" 53 | 54 | This may not be obvious at first, is that YAML Front-Matter acts as a kind of "conduit" for passing information to pages via Lo-Dash templates. 55 | 56 | So you could do this: 57 | 58 | ``` js 59 | grunt.initConfig({ 60 | assemble: { 61 | component: { 62 | options: { 63 | data: 'page.json' 64 | }, 65 | files: { 66 | 'index.html': ['src/pages/*.hbs'] 67 | } 68 | } 69 | } 70 | }); 71 | ``` 72 | 73 | With `page.json` containing: 74 | 75 | ``` json 76 | { 77 | "index": { 78 | "title": "Home" 79 | }, 80 | "about": { 81 | "title": "About Us" 82 | } 83 | } 84 | ``` 85 | 86 | And the [YAML Front-Matter]() of the page, use underscore templates: 87 | 88 | ``` yaml 89 | --- 90 | title: <%= page.index.title %> 91 | --- 92 | 93 | YAML front matter 94 | ``` 95 | 96 | Alternatively, inside the Grunfile you can use `grunt.config.set` to define the data to be used for a given variable: 97 | 98 | ``` js 99 | grunt.config.set('page.index.title', 'Home'); 100 | ``` 101 | 102 | ### Example usage 103 | 104 | ``` html 105 | --- 106 | title: 107 | list: <% _.forEach(people, function(name) { %>
  • <%= name %>
  • <% }); %> 108 | people: 109 | - Jon Schlinkert 110 | - Brian Woodward 111 | --- 112 | 113 | 114 | 115 | 116 | YAML front matter 117 | 118 | 119 |
    120 |
      121 | 122 |
    123 |
    124 | 125 | 126 | ``` 127 | 128 | 129 | ``` yaml 130 | --- 131 | layout: default.hbs 132 | title: Early humans discovered... 133 | description: Lots of things, because they were early humans. 134 | date: 2013-07-04 135 | categories: 136 | - anthropology 137 | - unibrows 138 | - various wooly animals 139 | tags: 140 | - rocks 141 | - wheel 142 | - 30 inch wooden rims 143 | published: false 144 | --- 145 | ``` 146 | 147 | 148 | 149 | 150 | ``` html 151 | --- 152 | title: My Blog 153 | description: Like I said, my bloggg! 154 | example: 155 | custom: 156 | variables: 157 | - one 158 | - two 159 | - three 160 | --- 161 | 165 | 166 |
      167 | 168 |
    169 | ``` 170 | 171 | 172 | ## YAML Front-Matter in Partials 173 | 174 | ``` html 175 | --- 176 | title: <%= component.name ][ pkg.name % 177 | require: [<%= title %>.css, <%= title %>.js] 178 | --- 179 | 180 |
    181 |
    182 | 192 |
    193 |
    194 | ``` 195 | 196 | 197 | ``` html 198 | 199 | 200 | 201 | 202 | \{{ titleize component }} Component 203 | 204 | 205 | 206 |
    207 | \{{> body }} 208 |
    209 | 210 | 211 | 212 | ``` 213 | 214 | ### Rendering Lists 215 | 216 | Use [YAML Associative Arrays](http://en.wikipedia.org/wiki/YAML#Associative_arrays_of_lists) for rendering lists of information. 217 | 218 | Indented Blocks, common in YAML data files, use indentation and new lines to separate the `key: value` pairs 219 | 220 | ``` yaml 221 | --- 222 | title: Associative arrays 223 | people: 224 | name: John Smith 225 | age: 33 226 | ``` 227 | 228 | Inline Blocks, common in YAML data streams, use comma+space to separate the `key: value` pairs between braces: 229 | 230 | ``` yaml 231 | morePeople: {name: Grace Jones, age: 21} 232 | --- 233 | ``` 234 | Used like this: 235 | 236 | ``` html 237 | 240 | 241 |
    242 |

    Associative arrays

    243 |
    244 | \{{#people}} 245 |
    Name:
    \{{name}}
    246 |
    Age:
    \{{age}}
    247 | \{{/people}} 248 | \{{#morePeople}} 249 |
    Name:
    \{{name}}
    250 |
    Age:
    \{{age}}
    251 | \{{/morePeople}} 252 |
    253 |
    254 | ``` 255 | 256 | ### [More examples](https://assemble/assemble/test/actual/yaml) 257 | 258 | See some great usage examples in assemble's [YAML test files](https://assemble/assemble/test/actual/yaml): 259 | 260 | * YAML associative arrays 261 | * YAML block literals 262 | * YAML comments 263 | * YAML data files 264 | * YAML data types 265 | * YAML documents 266 | * YAML lists 267 | * YAML relational-trees 268 | * YAML variables 269 | 270 | 271 | 272 | 273 | 274 | **Please note**: _YFM cannot be parsed if it is not the first thing on the page_. 275 | 276 | 277 | [YAML Front-Matter](https://github.com/mojombo/jekyll/wiki/YAML-Front-Matter) was made popular by Jekyll, the "blog-aware, static site generator" that powers GitHub Pages. 278 | 279 | 280 | * YAML front-matter is **optionally** used at the beginning of a page to define metadata for the page's content. 281 | * In order for YAML front-matter to be processed, it _must be the first thing at the top of the page_, and 282 | * To be valid, it must be "wrapped" with three leading dashes (above) (`---`) and three dashes following (below) (`---`). 283 | 284 | Example: 285 | 286 | ``` html 287 | --- 288 | title: YAML front-matter 289 | description: A very simple way to add structured data to a page. 290 | --- 291 | 292 | "Front matter is essentially metadata about the document its attached to, formatted in such a way that it does not get in the way. In other words, if you don't know its “Front Matter”, you probably wouldn't wonder what it is, or what its doing there." 293 | 294 | 295 | 296 |

    \{{ title }}

    297 |

    Page content here... \{{ eieio }}

    298 | ``` 299 | 300 | 301 | 302 | ## FAQ 303 | 304 | * With [Assemble](https://github.com/assemble/assemble) you may do [just about anything](https://github.com/assemble/assemble/tree/master/test/YAML) with YAML front matter that you can do with [valid YAML](http://www.yaml.org/spec/1.2/spec.html) 305 | * YFM must be [valid YAML](http://www.yaml.org/spec/1.2/spec.html) 306 | * YFM cannot be parsed if it is not the first thing on the page 307 | * [Assemble](https://github.com/assemble/assemble) parses YAML front matter into an object literal. 308 | * YFM allows you to define variables for a page, directly inside the page. 309 | 310 | **Custom Variables** 311 | * You may use any of the default variables provided by Assemble, or you may define your own custom variables inside the YFM of a file. 312 | * You may add as many custom variables as you require 313 | 314 | **Lo-Dash Templates** 315 | * You may use underscore [Lo-Dash templates][lodash] in YFM 316 | * Assemble exposes all variables defined in YAML front-matter to the page in which they were defined, thus... 317 | * Using [Lo-Dash templates][lodash] in YFM enables programmatic access to those pages across your project. 318 | * YFM may be used in any file that Assemble processes through any of the [src-dest or files mappings formats][files] available in Grunt.js. 319 | 320 | 321 | ### Recommended usage 322 | * YFM is best used for structured data, like configuration settings or metadata for a page, as opposed to long-form content. 323 | * YFM offers an easy way to maintain metadata or rendered data for pages and partials, as an _optional_ alternative to using "external" `.json` or `.yaml` data files 324 | 325 | 326 | ### Not recommended 327 | * YFM isn't the best option for long-form content or extensive amounts of metadata. In these cases you might want to consider externalizing your data to [JSON][] or [YAML][] files instead. 328 | 329 | 330 | 331 | ## Related info 332 | 333 | * [YAML data][YAML] 334 | * [JSON data][JSON] 335 | 336 | 337 | ## External links 338 | 339 | * [js-yaml "online"](http://nodeca.github.io/js-yaml/) allows you to play with YAML in the browser. 340 | * [YAML specification](http://www.yaml.org/spec/1.2/spec.html) 341 | * [http://www.yaml.org/](http://www.yaml.org/) 342 | * [wikipedia page about YAML](http://en.wikipedia.org/wiki/YAML) 343 | 344 | -------------------------------------------------------------------------------- /dest/assets/highlight.js: -------------------------------------------------------------------------------- 1 | var hljs=new function(){function l(o){return o.replace(/&/gm,"&").replace(//gm,">")}function b(p){for(var o=p.firstChild;o;o=o.nextSibling){if(o.nodeName=="CODE"){return o}if(!(o.nodeType==3&&o.nodeValue.match(/\s+/))){break}}}function h(p,o){return Array.prototype.map.call(p.childNodes,function(q){if(q.nodeType==3){return o?q.nodeValue.replace(/\n/g,""):q.nodeValue}if(q.nodeName=="BR"){return"\n"}return h(q,o)}).join("")}function a(q){var p=(q.className+" "+q.parentNode.className).split(/\s+/);p=p.map(function(r){return r.replace(/^language-/,"")});for(var o=0;o"}while(x.length||v.length){var u=t().splice(0,1)[0];y+=l(w.substr(p,u.offset-p));p=u.offset;if(u.event=="start"){y+=s(u.node);r.push(u.node)}else{if(u.event=="stop"){var o,q=r.length;do{q--;o=r[q];y+=("")}while(o!=u.node);r.splice(q,1);while(q'+L[0]+""}else{r+=L[0]}N=A.lR.lastIndex;L=A.lR.exec(K)}return r+K.substr(N)}function z(){if(A.sL&&!e[A.sL]){return l(w)}var r=A.sL?d(A.sL,w):g(w);if(A.r>0){v+=r.keyword_count;B+=r.r}return''+r.value+""}function J(){return A.sL!==undefined?z():G()}function I(L,r){var K=L.cN?'':"";if(L.rB){x+=K;w=""}else{if(L.eB){x+=l(r)+K;w=""}else{x+=K;w=r}}A=Object.create(L,{parent:{value:A}});B+=L.r}function C(K,r){w+=K;if(r===undefined){x+=J();return 0}var L=o(r,A);if(L){x+=J();I(L,r);return L.rB?0:r.length}var M=s(A,r);if(M){if(!(M.rE||M.eE)){w+=r}x+=J();do{if(A.cN){x+=""}A=A.parent}while(A!=M.parent);if(M.eE){x+=l(r)}w="";if(M.starts){I(M.starts,"")}return M.rE?0:r.length}if(t(r,A)){throw"Illegal"}w+=r;return r.length||1}var F=e[D];f(F);var A=F;var w="";var B=0;var v=0;var x="";try{var u,q,p=0;while(true){A.t.lastIndex=p;u=A.t.exec(E);if(!u){break}q=C(E.substr(p,u.index-p),u[0]);p=u.index+q}C(E.substr(p));return{r:B,keyword_count:v,value:x,language:D}}catch(H){if(H=="Illegal"){return{r:0,keyword_count:0,value:l(E)}}else{throw H}}}function g(s){var o={keyword_count:0,r:0,value:l(s)};var q=o;for(var p in e){if(!e.hasOwnProperty(p)){continue}var r=d(p,s);r.language=p;if(r.keyword_count+r.r>q.keyword_count+q.r){q=r}if(r.keyword_count+r.r>o.keyword_count+o.r){q=o;o=r}}if(q.language){o.second_best=q}return o}function i(q,p,o){if(p){q=q.replace(/^((<[^>]+>|\t)+)/gm,function(r,v,u,t){return v.replace(/\t/g,p)})}if(o){q=q.replace(/\n/g,"
    ")}return q}function m(r,u,p){var v=h(r,p);var t=a(r);if(t=="no-highlight"){return}var w=t?d(t,v):g(v);t=w.language;var o=c(r);if(o.length){var q=document.createElement("pre");q.innerHTML=w.value;w.value=j(o,c(q),v)}w.value=i(w.value,u,p);var s=r.className;if(!s.match("(\\s|^)(language-)?"+t+"(\\s|$)")){s=s?(s+" "+t):t}r.innerHTML=w.value;r.className=s;r.result={language:t,kw:w.keyword_count,re:w.r};if(w.second_best){r.second_best={language:w.second_best.language,kw:w.second_best.keyword_count,re:w.second_best.r}}}function n(){if(n.called){return}n.called=true;Array.prototype.map.call(document.getElementsByTagName("pre"),b).filter(Boolean).forEach(function(o){m(o,hljs.tabReplace)})}function k(){window.addEventListener("DOMContentLoaded",n,false);window.addEventListener("load",n,false)}var e={};this.LANGUAGES=e;this.highlight=d;this.highlightAuto=g;this.fixMarkup=i;this.highlightBlock=m;this.initHighlighting=n;this.initHighlightingOnLoad=k;this.IR="[a-zA-Z][a-zA-Z0-9_]*";this.UIR="[a-zA-Z_][a-zA-Z0-9_]*";this.NR="\\b\\d+(\\.\\d+)?";this.CNR="(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)";this.BNR="\\b(0b[01]+)";this.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|\\.|-|-=|/|/=|:|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";this.BE={b:"\\\\[\\s\\S]",r:0};this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[this.BE],r:0};this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[this.BE],r:0};this.CLCM={cN:"comment",b:"//",e:"$"};this.CBLCLM={cN:"comment",b:"/\\*",e:"\\*/"};this.HCM={cN:"comment",b:"#",e:"$"};this.NM={cN:"number",b:this.NR,r:0};this.CNM={cN:"number",b:this.CNR,r:0};this.BNM={cN:"number",b:this.BNR,r:0};this.inherit=function(q,r){var o={};for(var p in q){o[p]=q[p]}if(r){for(var p in r){o[p]=r[p]}}return o}}();hljs.LANGUAGES.bash=function(a){var g="true false";var e="if then else elif fi for break continue while in do done echo exit return set declare";var c={cN:"variable",b:"\\$[a-zA-Z0-9_#]+"};var b={cN:"variable",b:"\\${([^}]|\\\\})+}"};var h={cN:"string",b:'"',e:'"',i:"\\n",c:[a.BE,c,b],r:0};var d={cN:"string",b:"'",e:"'",c:[{b:"''"}],r:0};var f={cN:"test_condition",b:"",e:"",c:[h,d,c,b],k:{literal:g},r:0};return{k:{keyword:e,literal:g},c:[{cN:"shebang",b:"(#!\\/bin\\/bash)|(#!\\/bin\\/sh)",r:10},c,b,a.HCM,h,d,a.inherit(f,{b:"\\[ ",e:" \\]",r:0}),a.inherit(f,{b:"\\[\\[ ",e:" \\]\\]"})]}}(hljs);hljs.LANGUAGES.cs=function(a){return{k:"abstract as base bool break byte case catch char checked class const continue decimal default delegate do double else enum event explicit extern false finally fixed float for foreach goto if implicit in int interface internal is lock long namespace new null object operator out override params private protected public readonly ref return sbyte sealed short sizeof stackalloc static string struct switch this throw true try typeof uint ulong unchecked unsafe ushort using virtual volatile void while ascending descending from get group into join let orderby partial select set value var where yield",c:[{cN:"comment",b:"///",e:"$",rB:true,c:[{cN:"xmlDocTag",b:"///|"},{cN:"xmlDocTag",b:""}]},a.CLCM,a.CBLCLM,{cN:"preprocessor",b:"#",e:"$",k:"if else elif endif define undef warning error line region endregion pragma checksum"},{cN:"string",b:'@"',e:'"',c:[{b:'""'}]},a.ASM,a.QSM,a.CNM]}}(hljs);hljs.LANGUAGES.ruby=function(e){var a="[a-zA-Z_][a-zA-Z0-9_]*(\\!|\\?)?";var j="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?";var g={keyword:"and false then defined module in return redo if BEGIN retry end for true self when next until do begin unless END rescue nil else break undef not super class case require yield alias while ensure elsif or include"};var c={cN:"yardoctag",b:"@[A-Za-z]+"};var k=[{cN:"comment",b:"#",e:"$",c:[c]},{cN:"comment",b:"^\\=begin",e:"^\\=end",c:[c],r:10},{cN:"comment",b:"^__END__",e:"\\n$"}];var d={cN:"subst",b:"#\\{",e:"}",l:a,k:g};var i=[e.BE,d];var b=[{cN:"string",b:"'",e:"'",c:i,r:0},{cN:"string",b:'"',e:'"',c:i,r:0},{cN:"string",b:"%[qw]?\\(",e:"\\)",c:i},{cN:"string",b:"%[qw]?\\[",e:"\\]",c:i},{cN:"string",b:"%[qw]?{",e:"}",c:i},{cN:"string",b:"%[qw]?<",e:">",c:i,r:10},{cN:"string",b:"%[qw]?/",e:"/",c:i,r:10},{cN:"string",b:"%[qw]?%",e:"%",c:i,r:10},{cN:"string",b:"%[qw]?-",e:"-",c:i,r:10},{cN:"string",b:"%[qw]?\\|",e:"\\|",c:i,r:10}];var h={cN:"function",bWK:true,e:" |$|;",k:"def",c:[{cN:"title",b:j,l:a,k:g},{cN:"params",b:"\\(",e:"\\)",l:a,k:g}].concat(k)};var f=k.concat(b.concat([{cN:"class",bWK:true,e:"$|;",k:"class module",c:[{cN:"title",b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?",r:0},{cN:"inheritance",b:"<\\s*",c:[{cN:"parent",b:"("+e.IR+"::)?"+e.IR}]}].concat(k)},h,{cN:"constant",b:"(::)?(\\b[A-Z]\\w*(::)?)+",r:0},{cN:"symbol",b:":",c:b.concat([{b:j}]),r:0},{cN:"symbol",b:a+":",r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{cN:"number",b:"\\?\\w"},{cN:"variable",b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},{b:"("+e.RSR+")\\s*",c:k.concat([{cN:"regexp",b:"/",e:"/[a-z]*",i:"\\n",c:[e.BE,d]}]),r:0}]));d.c=f;h.c[1].c=f;return{l:a,k:g,c:f}}(hljs);hljs.LANGUAGES.diff=function(a){return{c:[{cN:"chunk",b:"^\\@\\@ +\\-\\d+,\\d+ +\\+\\d+,\\d+ +\\@\\@$",r:10},{cN:"chunk",b:"^\\*\\*\\* +\\d+,\\d+ +\\*\\*\\*\\*$",r:10},{cN:"chunk",b:"^\\-\\-\\- +\\d+,\\d+ +\\-\\-\\-\\-$",r:10},{cN:"header",b:"Index: ",e:"$"},{cN:"header",b:"=====",e:"=====$"},{cN:"header",b:"^\\-\\-\\-",e:"$"},{cN:"header",b:"^\\*{3} ",e:"$"},{cN:"header",b:"^\\+\\+\\+",e:"$"},{cN:"header",b:"\\*{5}",e:"\\*{5}$"},{cN:"addition",b:"^\\+",e:"$"},{cN:"deletion",b:"^\\-",e:"$"},{cN:"change",b:"^\\!",e:"$"}]}}(hljs);hljs.LANGUAGES.javascript=function(a){return{k:{keyword:"in if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const",literal:"true false null undefined NaN Infinity"},c:[a.ASM,a.QSM,a.CLCM,a.CBLCLM,a.CNM,{b:"("+a.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[a.CLCM,a.CBLCLM,{cN:"regexp",b:"/",e:"/[gim]*",i:"\\n",c:[{b:"\\\\/"}]},{b:"<",e:">;",sL:"xml"}],r:0},{cN:"function",bWK:true,e:"{",k:"function",c:[{cN:"title",b:"[A-Za-z$_][0-9A-Za-z$_]*"},{cN:"params",b:"\\(",e:"\\)",c:[a.CLCM,a.CBLCLM],i:"[\"'\\(]"}],i:"\\[|%"}]}}(hljs);hljs.LANGUAGES.css=function(a){var b={cN:"function",b:a.IR+"\\(",e:"\\)",c:[a.NM,a.ASM,a.QSM]};return{cI:true,i:"[=/|']",c:[a.CBLCLM,{cN:"id",b:"\\#[A-Za-z0-9_-]+"},{cN:"class",b:"\\.[A-Za-z0-9_-]+",r:0},{cN:"attr_selector",b:"\\[",e:"\\]",i:"$"},{cN:"pseudo",b:":(:)?[a-zA-Z0-9\\_\\-\\+\\(\\)\\\"\\']+"},{cN:"at_rule",b:"@(font-face|page)",l:"[a-z-]+",k:"font-face page"},{cN:"at_rule",b:"@",e:"[{;]",eE:true,k:"import page media charset",c:[b,a.ASM,a.QSM,a.NM]},{cN:"tag",b:a.IR,r:0},{cN:"rules",b:"{",e:"}",i:"[^\\s]",r:0,c:[a.CBLCLM,{cN:"rule",b:"[^\\s]",rB:true,e:";",eW:true,c:[{cN:"attribute",b:"[A-Z\\_\\.\\-]+",e:":",eE:true,i:"[^\\s]",starts:{cN:"value",eW:true,eE:true,c:[b,a.NM,a.QSM,a.ASM,a.CBLCLM,{cN:"hexcolor",b:"\\#[0-9A-F]+"},{cN:"important",b:"!important"}]}}]}]}]}}(hljs);hljs.LANGUAGES.xml=function(a){var c="[A-Za-z0-9\\._:-]+";var b={eW:true,c:[{cN:"attribute",b:c,r:0},{b:'="',rB:true,e:'"',c:[{cN:"value",b:'"',eW:true}]},{b:"='",rB:true,e:"'",c:[{cN:"value",b:"'",eW:true}]},{b:"=",c:[{cN:"value",b:"[^\\s/>]+"}]}]};return{cI:true,c:[{cN:"pi",b:"<\\?",e:"\\?>",r:10},{cN:"doctype",b:"",r:10,c:[{b:"\\[",e:"\\]"}]},{cN:"comment",b:"",r:10},{cN:"cdata",b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"|$)",e:">",k:{title:"style"},c:[b],starts:{e:"",rE:true,sL:"css"}},{cN:"tag",b:"|$)",e:">",k:{title:"script"},c:[b],starts:{e:"<\/script>",rE:true,sL:"javascript"}},{b:"<%",e:"%>",sL:"vbscript"},{cN:"tag",b:"",c:[{cN:"title",b:"[^ />]+"},b]}]}}(hljs);hljs.LANGUAGES.http=function(a){return{i:"\\S",c:[{cN:"status",b:"^HTTP/[0-9\\.]+",e:"$",c:[{cN:"number",b:"\\b\\d{3}\\b"}]},{cN:"request",b:"^[A-Z]+ (.*?) HTTP/[0-9\\.]+$",rB:true,e:"$",c:[{cN:"string",b:" ",e:" ",eB:true,eE:true}]},{cN:"attribute",b:"^\\w",e:": ",eE:true,i:"\\n|\\s|=",starts:{cN:"string",e:"$"}},{b:"\\n\\n",starts:{sL:"",eW:true}}]}}(hljs);hljs.LANGUAGES.java=function(a){return{k:"false synchronized int abstract float private char boolean static null if const for true while long throw strictfp finally protected import native final return void enum else break transient new catch instanceof byte super volatile case assert short package default double public try this switch continue throws",c:[{cN:"javadoc",b:"/\\*\\*",e:"\\*/",c:[{cN:"javadoctag",b:"@[A-Za-z]+"}],r:10},a.CLCM,a.CBLCLM,a.ASM,a.QSM,{cN:"class",bWK:true,e:"{",k:"class interface",i:":",c:[{bWK:true,k:"extends implements",r:10},{cN:"title",b:a.UIR}]},a.CNM,{cN:"annotation",b:"@[A-Za-z]+"}]}}(hljs);hljs.LANGUAGES.php=function(a){var e={cN:"variable",b:"\\$+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*"};var b=[a.inherit(a.ASM,{i:null}),a.inherit(a.QSM,{i:null}),{cN:"string",b:'b"',e:'"',c:[a.BE]},{cN:"string",b:"b'",e:"'",c:[a.BE]}];var c=[a.BNM,a.CNM];var d={cN:"title",b:a.UIR};return{cI:true,k:"and include_once list abstract global private echo interface as static endswitch array null if endwhile or const for endforeach self var while isset public protected exit foreach throw elseif include __FILE__ empty require_once do xor return implements parent clone use __CLASS__ __LINE__ else break print eval new catch __METHOD__ case exception php_user_filter default die require __FUNCTION__ enddeclare final try this switch continue endfor endif declare unset true false namespace trait goto instanceof insteadof __DIR__ __NAMESPACE__ __halt_compiler",c:[a.CLCM,a.HCM,{cN:"comment",b:"/\\*",e:"\\*/",c:[{cN:"phpdoc",b:"\\s@[A-Za-z]+"}]},{cN:"comment",eB:true,b:"__halt_compiler.+?;",eW:true},{cN:"string",b:"<<<['\"]?\\w+['\"]?$",e:"^\\w+;",c:[a.BE]},{cN:"preprocessor",b:"<\\?php",r:10},{cN:"preprocessor",b:"\\?>"},e,{cN:"function",bWK:true,e:"{",k:"function",i:"\\$|\\[|%",c:[d,{cN:"params",b:"\\(",e:"\\)",c:["self",e,a.CBLCLM].concat(b).concat(c)}]},{cN:"class",bWK:true,e:"{",k:"class",i:"[:\\(\\$]",c:[{bWK:true,eW:true,k:"extends",c:[d]},d]},{b:"=>"}].concat(b).concat(c)}}(hljs);hljs.LANGUAGES.python=function(a){var f={cN:"prompt",b:"^(>>>|\\.\\.\\.) "};var c=[{cN:"string",b:"(u|b)?r?'''",e:"'''",c:[f],r:10},{cN:"string",b:'(u|b)?r?"""',e:'"""',c:[f],r:10},{cN:"string",b:"(u|r|ur)'",e:"'",c:[a.BE],r:10},{cN:"string",b:'(u|r|ur)"',e:'"',c:[a.BE],r:10},{cN:"string",b:"(b|br)'",e:"'",c:[a.BE]},{cN:"string",b:'(b|br)"',e:'"',c:[a.BE]}].concat([a.ASM,a.QSM]);var e={cN:"title",b:a.UIR};var d={cN:"params",b:"\\(",e:"\\)",c:["self",a.CNM,f].concat(c)};var b={bWK:true,e:":",i:"[${=;\\n]",c:[e,d],r:10};return{k:{keyword:"and elif is global as in if from raise for except finally print import pass return exec else break not with class assert yield try while continue del or def lambda nonlocal|10",built_in:"None True False Ellipsis NotImplemented"},i:"(|\\?)",c:c.concat([f,a.HCM,a.inherit(b,{cN:"function",k:"def"}),a.inherit(b,{cN:"class",k:"class"}),a.CNM,{cN:"decorator",b:"@",e:"$"},{b:"\\b(print|exec)\\("}])}}(hljs);hljs.LANGUAGES.sql=function(a){return{cI:true,c:[{cN:"operator",b:"(begin|start|commit|rollback|savepoint|lock|alter|create|drop|rename|call|delete|do|handler|insert|load|replace|select|truncate|update|set|show|pragma|grant)\\b(?!:)",e:";",eW:true,k:{keyword:"all partial global month current_timestamp using go revoke smallint indicator end-exec disconnect zone with character assertion to add current_user usage input local alter match collate real then rollback get read timestamp session_user not integer bit unique day minute desc insert execute like ilike|2 level decimal drop continue isolation found where constraints domain right national some module transaction relative second connect escape close system_user for deferred section cast current sqlstate allocate intersect deallocate numeric public preserve full goto initially asc no key output collation group by union session both last language constraint column of space foreign deferrable prior connection unknown action commit view or first into float year primary cascaded except restrict set references names table outer open select size are rows from prepare distinct leading create only next inner authorization schema corresponding option declare precision immediate else timezone_minute external varying translation true case exception join hour default double scroll value cursor descriptor values dec fetch procedure delete and false int is describe char as at in varchar null trailing any absolute current_time end grant privileges when cross check write current_date pad begin temporary exec time update catalog user sql date on identity timezone_hour natural whenever interval work order cascade diagnostics nchar having left call do handler load replace truncate start lock show pragma exists number",aggregate:"count sum min max avg"},c:[{cN:"string",b:"'",e:"'",c:[a.BE,{b:"''"}],r:0},{cN:"string",b:'"',e:'"',c:[a.BE,{b:'""'}],r:0},{cN:"string",b:"`",e:"`",c:[a.BE]},a.CNM]},a.CBLCLM,{cN:"comment",b:"--",e:"$"}]}}(hljs);hljs.LANGUAGES.ini=function(a){return{cI:true,i:"[^\\s]",c:[{cN:"comment",b:";",e:"$"},{cN:"title",b:"^\\[",e:"\\]"},{cN:"setting",b:"^[a-z0-9\\[\\]_-]+[ \\t]*=[ \\t]*",e:"$",c:[{cN:"value",eW:true,k:"on off true false yes no",c:[a.QSM,a.NM]}]}]}}(hljs);hljs.LANGUAGES.perl=function(e){var a="getpwent getservent quotemeta msgrcv scalar kill dbmclose undef lc ma syswrite tr send umask sysopen shmwrite vec qx utime local oct semctl localtime readpipe do return format read sprintf dbmopen pop getpgrp not getpwnam rewinddir qqfileno qw endprotoent wait sethostent bless s|0 opendir continue each sleep endgrent shutdown dump chomp connect getsockname die socketpair close flock exists index shmgetsub for endpwent redo lstat msgctl setpgrp abs exit select print ref gethostbyaddr unshift fcntl syscall goto getnetbyaddr join gmtime symlink semget splice x|0 getpeername recv log setsockopt cos last reverse gethostbyname getgrnam study formline endhostent times chop length gethostent getnetent pack getprotoent getservbyname rand mkdir pos chmod y|0 substr endnetent printf next open msgsnd readdir use unlink getsockopt getpriority rindex wantarray hex system getservbyport endservent int chr untie rmdir prototype tell listen fork shmread ucfirst setprotoent else sysseek link getgrgid shmctl waitpid unpack getnetbyname reset chdir grep split require caller lcfirst until warn while values shift telldir getpwuid my getprotobynumber delete and sort uc defined srand accept package seekdir getprotobyname semop our rename seek if q|0 chroot sysread setpwent no crypt getc chown sqrt write setnetent setpriority foreach tie sin msgget map stat getlogin unless elsif truncate exec keys glob tied closedirioctl socket readlink eval xor readline binmode setservent eof ord bind alarm pipe atan2 getgrent exp time push setgrent gt lt or ne m|0 break given say state when";var d={cN:"subst",b:"[$@]\\{",e:"\\}",k:a,r:10};var b={cN:"variable",b:"\\$\\d"};var i={cN:"variable",b:"[\\$\\%\\@\\*](\\^\\w\\b|#\\w+(\\:\\:\\w+)*|[^\\s\\w{]|{\\w+}|\\w+(\\:\\:\\w*)*)"};var f=[e.BE,d,b,i];var h={b:"->",c:[{b:e.IR},{b:"{",e:"}"}]};var g={cN:"comment",b:"^(__END__|__DATA__)",e:"\\n$",r:5};var c=[b,i,e.HCM,g,{cN:"comment",b:"^\\=\\w",e:"\\=cut",eW:true},h,{cN:"string",b:"q[qwxr]?\\s*\\(",e:"\\)",c:f,r:5},{cN:"string",b:"q[qwxr]?\\s*\\[",e:"\\]",c:f,r:5},{cN:"string",b:"q[qwxr]?\\s*\\{",e:"\\}",c:f,r:5},{cN:"string",b:"q[qwxr]?\\s*\\|",e:"\\|",c:f,r:5},{cN:"string",b:"q[qwxr]?\\s*\\<",e:"\\>",c:f,r:5},{cN:"string",b:"qw\\s+q",e:"q",c:f,r:5},{cN:"string",b:"'",e:"'",c:[e.BE],r:0},{cN:"string",b:'"',e:'"',c:f,r:0},{cN:"string",b:"`",e:"`",c:[e.BE]},{cN:"string",b:"{\\w+}",r:0},{cN:"string",b:"-?\\w+\\s*\\=\\>",r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{b:"("+e.RSR+"|\\b(split|return|print|reverse|grep)\\b)\\s*",k:"split return print reverse grep",r:0,c:[e.HCM,g,{cN:"regexp",b:"(s|tr|y)/(\\\\.|[^/])*/(\\\\.|[^/])*/[a-z]*",r:10},{cN:"regexp",b:"(m|qr)?/",e:"/[a-z]*",c:[e.BE],r:0}]},{cN:"sub",bWK:true,e:"(\\s*\\(.*?\\))?[;{]",k:"sub",r:5},{cN:"operator",b:"-\\w\\b",r:0}];d.c=c;h.c[1].c=c;return{k:a,c:c}}(hljs);hljs.LANGUAGES.json=function(a){var e={literal:"true false null"};var d=[a.QSM,a.CNM];var c={cN:"value",e:",",eW:true,eE:true,c:d,k:e};var b={b:"{",e:"}",c:[{cN:"attribute",b:'\\s*"',e:'"\\s*:\\s*',eB:true,eE:true,c:[a.BE],i:"\\n",starts:c}],i:"\\S"};var f={b:"\\[",e:"\\]",c:[a.inherit(c,{cN:null})],i:"\\S"};d.splice(d.length,0,b,f);return{c:d,k:e,i:"\\S"}}(hljs);hljs.LANGUAGES.cpp=function(a){var b={keyword:"false int float while private char catch export virtual operator sizeof dynamic_cast|10 typedef const_cast|10 const struct for static_cast|10 union namespace unsigned long throw volatile static protected bool template mutable if public friend do return goto auto void enum else break new extern using true class asm case typeid short reinterpret_cast|10 default double register explicit signed typename try this switch continue wchar_t inline delete alignof char16_t char32_t constexpr decltype noexcept nullptr static_assert thread_local restrict _Bool complex",built_in:"std string cin cout cerr clog stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap array shared_ptr"};return{k:b,i:"",k:b,r:10,c:["self"]}]}}(hljs); 2 | 3 | 4 | hljs.initHighlightingOnLoad(); --------------------------------------------------------------------------------