While this is generally nice, as users can avoid the (link: …) tag in markdown, it is a bit annoying when one wants to output Javascript in a Kirby Tag.
Is this functionality intended? How can I use URL in tags without them being replaced as valid HTML? Am I missing something here?
Turning off URL rewriting in the config only seems to turn off the automatic URL conversion in user entered markdown text, back-end functions such as tags are not affected: http://getkirby.com/docs/cheatsheet/options/rewrite
Oh ok, my bad. In that case the option really has nothing to do with it.
As a minimal working example, I am looking to write a Kirby tag, which allows me to return a plain URL (without <a href ...) into HTML. Such as the one shown above. In my case, the text which is returned and entered into the page is no www. google. com (without spaces, forum doesn’t allow me to post different), but <a href="https://www.google.com">https://www.google.com</a>
I am building a Kirby tag that outputs Javascript. In this case I of course do not want the URL that I return from my tag to be replaced with a proper HTML link, but rather have the raw string, as I defined it.
Basically the minimal working example in the first post should output text, not a link.
If you want the tag to return JavaScript, then the minimal working example is a <script> tag, isn’t it?
Because if you return a <script> tag (or any HTML tag), the Markdown parser won’t mess with it.
Well, yes. Of course this is not JavaScript. Maybe the MWE was too minimal.
While trying to construct an example closer to the reality of my problem, I actually managed to find the error: It seems Kirby expects that the return from a tag is a single HTML “unit” and in itself complete. If that is not the case, it is enclosed in <p>...</p> and the Markdown parser might run.
I recommend including the JS and CSS files one time in your footer anyway, not every time the tag is called. Otherwise you might have multiple instances of the <link> and <script> tags on your page.
Indeed, I noticed that this works while creating the examples above. This is how I came up with the solution.
Thanks for the hint. It is certainly not ideal to include all scripts here, I might have to convert the tag into a full size plugin to accomplish a separation of actual code and includes, or add an additional tag to be added to every header, both not ideal for the user. While the resulting tag could be used more than once on a single page, this is typically not the case, due to its application. Anyway, I will consider.