Плагины тегов

Плагины тегов отличаются от тегов в посте. Они портированы с Octopress и обеспечивают удобный способ, чтобы быстро добавить контент для ваших постов.

Блок цитаты

Подходит для добавления цитаты в свой пост с указанием автора, источника и информационным заголовком.

Блок данных: цитата

{% blockquote [author[, source]] [link] [source_link_title] %}
content
{% endblockquote %}

Примеры

Без аргументов. Обычная цитата.

{% blockquote %}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque hendrerit lacus ut purus iaculis feugiat. Sed nec tempor elit, quis aliquam neque. Curabitur sed diam eget dolor fermentum semper at eu lorem.
{% endblockquote %}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque hendrerit lacus ut purus iaculis feugiat. Sed nec tempor elit, quis aliquam neque. Curabitur sed diam eget dolor fermentum semper at eu lorem.

Цитата из книги

{% blockquote David Levithan, Wide Awake %}
Do not just seek happiness for yourself. Seek happiness for all. Through kindness. Through mercy.
{% endblockquote %}

Do not just seek happiness for yourself. Seek happiness for all. Through kindness. Through mercy.

David LevithanWide Awake

Цитата из Twitter

{% blockquote @DevDocs https://twitter.com/devdocs/status/356095192085962752 %}
NEW: DevDocs now comes with syntax highlighting. http://devdocs.io
{% endblockquote %}

NEW: DevDocs now comes with syntax highlighting. http://devdocs.io

Цитата из статьи в интернете

{% blockquote Seth Godin http://sethgodin.typepad.com/seths_blog/2009/07/welcome-to-island-marketing.html Welcome to Island Marketing %}
Every interaction is both precious and an opportunity to delight.
{% endblockquote %}

Every interaction is both precious and an opportunity to delight.

Блок с кодом

Полезная функция для добавления фрагментов кода в пост.

Блок данных: code (код)

{% codeblock [title] [lang:language] [url] [link text] [additional options] %}
code snippet
{% endcodeblock %}

Specify additional options in option:value format, e.g. line_number:false first_line:5.

Extra Options Description Default
line_number Show line number true
highlight Enable code highlighting true
first_line Specify the first line number 1
mark Line highlight specific line(s), each value separated by a comma. Specify number range using a dash
Example: mark:1,4-7,10 will mark line 1, 4 to 7 and 10.
wrap Wrap the code block in <table> true

Примеры

Простой блок кода

{% codeblock %}
alert('Hello World!');
{% endcodeblock %}
alert('Hello World!');

С указанием языка

{% codeblock lang:objc %}
[rectangle setX: 10 y: 10 width: 20 height: 20];
{% endcodeblock %}
[rectangle setX: 10 y: 10 width: 20 height: 20];

С добавление заголовка

{% codeblock Array.map %}
array.map(callback[, thisArg])
{% endcodeblock %}
Array.map
array.map(callback[, thisArg])

С добавлением заголовка и ссылки

{% codeblock _.compact http://underscorejs.org/#compact Underscore.js %}
_.compact([0, 1, false, 2, '', 3]);
=> [1, 2, 3]
{% endcodeblock %}
_.compactUnderscore.js
_.compact([0, 1, false, 2, '', 3]);
=> [1, 2, 3]

Блок кода в кавычках

Тот же блок кода, но использует три обратные кавычки для отделения блока.

``` [language] [title] [url] [link text] code snippet ```

Цитата

Добавляет цитату в пост:

{% pullquote [class] %}
content
{% endpullquote %}

jsFiddle

Размещает фрагмент с jsFiddle:

{% jsfiddle shorttag [tabs] [skin] [width] [height] %}

Gist

Размещает фрагмент с Gist:

{% gist gist_id [filename] %}

iframe

Размещает iframe:

{% iframe url [width] [height] %}

Картинка

Вставляет картинку с заданными размерами.

{% img [class names] /path/to/image [width] [height] '"title text" "alt text"' %}

Ссылка

Вставляет ссылку с атрибутом target="_blank".

{% link text url [external] [title] %}

Include Code

Вставляет фрагменты кода из папки source/downloads/code.

{% include_code [title] [lang:language] path/to/file %}

YouTube

Вставка видео с YouTube.

{% youtube video_id %}

Vimeo

Вставка видео с Vimeo.

{% vimeo video_id %}

Включения из постов

Содержит ссылку на другой пост.

{% post_path filename %}
{% post_link filename [title] [escape] %}

You can ignore permalink and folder information, like languages and dates, when using this tag.

For instance: {% post_link how-to-bake-a-cake %}.

This will work as long as the filename of the post is how-to-bake-a-cake.md, even if the post is located at source/posts/2015-02-my-family-holiday and has permalink 2018/en/how-to-bake-a-cake.

You can customize the text to display, instead of displaying the post’s title. Using post_path inside Markdown syntax []() is not supported.

Post’s title and custom text are escaped by default. You can use the escape option to disable escaping.

For instance:

Display title of the post.

{% post_link hexo-3-8-released %}

Display custom text.

{% post_link hexo-3-8-released 'Link to a post' %}

Escape title.

{% post_link hexo-4-released 'How to use <b> tag in title' %}

Do not escape title.

{% post_link hexo-4-released '<b>bold</b> custom title' false %}

Вставка материала

Содержит содержимое материала.

{% asset_path filename %}
{% asset_img filename [title] %}
{% asset_link filename [title] [escape] %}

Сырцы

Если определённый контент вызывает ошибки обработки в ваших постах, оберните его тегом raw, чтобы избежать ошибок обработки.

{% raw %}
content
{% endraw %}

Отрывок поста

Используйте текст до тега <!-- more --> в качестве отрывка поста.

Примеры:

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
<!-- more -->
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.