Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions docs/userGuide/plugins/filterTags.mbdf
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,27 @@ Tags are specified by the `tags` attribute, **and can be attached to any HTML el
<p tags="language--python">print("Hello world")</p>
```

You need to specify the tags to include in `site.json`, under the `tags` option:
You need to specify the tags to include in the `pluginsContext`, under `tags`:

```json
{
...
"tags": ["language--java"]
"plugins" : [
"filterTags"
],
"pluginsContext" : {
"filterTags" : {
"tags": ["language--java"]
}
}
}
```

All other tagged elements will be filtered out. In this case, only the element with the `language--java` tag will be rendered. This is helpful when creating multiple versions of a page without having to maintain separate copies.

</div>

If the `tags` option is not specified in `site.json`, all tagged elements will be rendered.
If the `filterTags` plugin is not enabled in `site.json`, all tagged elements will be rendered.

**You can also use multiple tags in a single HTML element. Specify each tag in the `tags` attribute** separated by a space. An element will be rendered if **any of the tags** matches the one in `site.json`.

Expand Down Expand Up @@ -121,7 +128,14 @@ site.json

{
...
"tags": ["-language--*", "language--C#"]
"plugins" : [
"filterTags"
],
"pluginsContext" : {
"filterTags" : {
"tags": ["-language--*", "language--C#"]
}
}
}
```

Expand Down
15 changes: 12 additions & 3 deletions docs/userGuide/siteConfiguration.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,14 @@ Here is a typical `site.json` file:
"*.mbd",
".git/*"
],
"tags": ["tag1", "tag2"],
"plugins" : [
"filterTags"
],
"pluginsContext" : {
"filterTags" : {
"tags": ["tag1", "tag2"]
}
},
"headingIndexingLevel": 4
}
```
Expand Down Expand Up @@ -164,9 +171,11 @@ The ignore pattern follows the [glob pattern used in .gitignore](https://git-scm
The branch that will be deployed to in the remote repo.
</div>

#### **`tags`**
#### **`plugins`**, **`pluginsContext`**

**A list of plugins to load.** Plugins are user-defined extensions that can add custom features to MarkBind. `pluginsContext` contains settings to be applied to the loaded plugins. See [User Guide: Using Plugins](usingPlugins.html) for more details.

**A list of tags to filter page elements.** Page elements with the specified tags are retained, while elements tagged with other tags are removed. Do not specify this option if you want to show everything. See [_User Guide: Tweaking the Page Structure → Using Tags_](tweakingThePageStructure.html#using-tags) section for more information.
The example above uses tags as an example of configuring plugin settings, refer to the [`filterTags` plugin](tweakingThePageStructure.html#filtertags-toggling-alternative-contents-in-a-page) for more details.

#### **`headingIndexingLevel`**

Expand Down