Skip to content
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#### `filterTags`: Toggling alternative contents in a page
## Tags
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we rename the file as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! Will do.


You can use tags to selectively filter HTML elements when building a site.

### Toggling alternative contents in a page

Tags are specified by the `tags` attribute, **and can be attached to any HTML element**. During rendering, only elements that match tags specified in the `site.json` files will be rendered.

<div class="indented">
Expand Down Expand Up @@ -81,7 +83,7 @@ Alternatively, you can specify tags to render for a page in the front matter.

Tags in `site.json` will be merged with the ones in the front matter, and are processed after front matter tags. See [Hiding Tags](../tweakingThePageStructure.html#hiding-tags) for more information.

#### Advanced Tagging Tips
### Advanced Tagging Tips

You can use a `*` in a tag name to match elements more generally. A `*` in a tag will match any number of characters at its position.

Expand All @@ -103,7 +105,7 @@ All 3 `<p>`s will be shown.

</div>

#### Hiding Tags
### Hiding Tags

Using `-` at the start of a tag hides all tags matching the expression. This is helpful for disabling a group of tags and enabling a particular tag.

Expand Down
4 changes: 2 additions & 2 deletions docs/userGuide/tweakingThePageStructure.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<frontmatter>
title: "User Guide: {{ title }}"
layout: userGuide
pageNav: 3
pageNav: 2
</frontmatter>

<span id="link" class="d-none">
Expand Down Expand Up @@ -43,7 +43,7 @@

<hr><!-- ======================================================================================================= -->

<include src="plugins/filterTags.mbdf" />
<include src="plugins/tags.mbdf" />

{% from "njk/common.njk" import previous_next %}
{{ previous_next('usingPlugins', 'reusingContents') }}
2 changes: 1 addition & 1 deletion docs/userGuide/usingPlugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ MarkBind has a set of built-in plugins that can be used immediately without inst

<include src="plugins/algolia.mbdf" />
<include src="plugins/codeBlockCopyButtons.mbdf" />
<include src="plugins/filterTags.mbdf" />
<include src="plugins/tags.mbdf" />
<include src="plugins/googleAnalytics.mbdf" />

{% from "njk/common.njk" import previous_next %}
Expand Down