How can I add a class to tables?

Hello together

To learn Kirby I hack together my own template with bootstrap. That actually works quite well. But I have a question where I currently do not know what to do.

When I create a table in the Kirby backend with Markdown it is successfully generated in the frontend. As an example, from the following…

| test | test |
| -- | -- |
| content | content |

…the following is generated in frontent:


That’s okay so far. But for the design of Bootstrap to work I have to change <table> to <table class="table">. So my question is:

How can I add a class to every table tag generated by Kirby?


You could use a kirbytext:after hook to replace <table> with <table class="table">.

That works. Thanks!

    'hooks' => [
        'kirbytext:after' => function ($text) {
            $text = str_replace("<table>",'<table class="table">',$text);
            return $text;