PHPackages                             hananils/kirby-tree-methods - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. hananils/kirby-tree-methods

ActiveKirby-plugin[Utility &amp; Helpers](/categories/utility)

hananils/kirby-tree-methods
===========================

HTML tree methods for Kirby 3

2.0.0(4y ago)211302MITPHP

Since Sep 25Pushed 3y ago4 watchersCompare

[ Source](https://github.com/hananils/kirby-tree-methods)[ Packagist](https://packagist.org/packages/hananils/kirby-tree-methods)[ RSS](/packages/hananils-kirby-tree-methods/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

[![Kirby Tree Methods](.github/title.png)](.github/title.png)

**Tree Methods** is a plugin for [Kirby 3](https://getkirby.com) to convert field values to HTML and adapt the resulting markup by changing headline hierarchy, wrapping and filtering elements, manipulating tag names, add classes or other attributes. The main purpose of the plugin is to take the field markup, that usually is a static string returned by a formatter, and help web designers to tailor it the way they need it and to apply typographic tweaks. Therefor is allows for:

1. selecting and filtering content,
2. manipulating the resulting markup,
3. outputing HTML.

The plugin works with all Kirby fields that allow for the generation of valid HTML, like **Blocks** or **textareas**. It also accepts custom methods to convert field values to HTML.

Examples
--------

[](#examples)

### Manipulating the headline hierarchy

[](#manipulating-the-headline-hierarchy)

Content:

```
Text:

# My first headline

## My second headline
```

Template:

```
// Set the starting headline level to three,
// making the document start as `h3` instead of `h1`

```

Output:

```
My first headline
My second headline
```

### Manipulating markup using snippets

[](#manipulating-markup-using-snippets)

Content:

```
Text:

These are Markdown paragraphs that an editor wrote that needs to be wrapped with special markup.

But the editor shouldn't have to care about markup in his Markdown document.
```

Template:

```
