I’m trying to setup instructions for posting in the info section of a template I’m building. I need to tell users how to add a class to an image, but when I write
(image: imagename.jpg class: classname)
it shows up in the panel as
<figure class="classname"><img alt="" src="http://localhost:8888/kirby/imagename.jpg"></figure>
I have tried using the code tags, but the only way I can figure out how to NOT use kirbytext is to add spaces, but that defeats the purpose of having an example for users to follow.
How can I write an example of Kirbytext for users to follow?
You can work around this problem by replacing the opening parenthesis with (
sections:
info:
headline: Info
type: info
text: |
To add an image, use (image: imagename.jpg class: classname)
3 Likes
Sorry to dig this up but as my question is closely related I wanted to add to this thread instead of creating a new one, to make it easier for people to find the information.
So, I would like to print the kirbytag inside code tags (backticks) for clearer formatting but if I do (tagname: value)
inside single backticks it will print the HTML entities literally, too (not even this textarea here allows me to format backticks inside inline code blocks). I want the kirbytag formatted as code, not as plain text, but with the parentheses showing up properly. Is there a way to do this (without using a hidden zero-width joiner character)?
You need to cheat a bit and use some sort of escape sequence that you replace in a hook:
info:
headline: Info
type: info
theme: neutral
text: |
To add an image, use `(&image: imagename.jpg class: classname)`
in config:
'hooks' => [
'kirbytags:after' => function (string $text, array $data, array $options) {
return preg_replace('/\(&/', '(', $text);
}
]
OK, thanks. Not what I was hoping for but it’s something.