The only thing required to fix #6 is adding |raw in the twig template. That's it. Four characters. I did a bunch of other stuff while figuring this out. If there's too much stuff and you don't feel like pulling this I can make a simpler PR with less changes.
Changelog:
Ran a formatter on the changed files
Declared all dependencies (and added tested versions)
Refactored id extraction and insertion
Now handles invalid id from shortcode eg. grav-id="id with spaces". It generates a new id if the one in parameters is invalid.
Add support for id shortcode parameter while keeping backwards compatibility with grav-id
Prioritize the id passed through parameters. If there's an id in the shortcode content AND in the parameters, the id is replaced with the one in the parameters.
Used twig |escape('js') to escape the options for DataTable. This in combination with JSON parsing the options allows passing more complicated options than just true / false
And of course used |raw in the template to output the table as HTML
Fixes #6
The only thing required to fix #6 is adding
|raw
in the twig template. That's it. Four characters. I did a bunch of other stuff while figuring this out. If there's too much stuff and you don't feel like pulling this I can make a simpler PR with less changes.Changelog:
grav-id="id with spaces"
. It generates a new id if the one in parameters is invalid.id
shortcode parameter while keeping backwards compatibility withgrav-id
|escape('js')
to escape the options for DataTable. This in combination with JSON parsing the options allows passing more complicated options than just true / false|raw
in the template to output the table as HTML