Using markdown in .txt file

Hi all,

Sorry, I’m aware this might be a simple question but i can’t seem to find answers in the resources or elsewhere online. Is markdown able to be used within a page’s .txt content file? The kirby docs seem like they are implying this, and of course there must be a way to specify bold/italic text, links etc. in the content file but when i use markdown here it comes out in plain text on my site. Is there a specific indicator that needs to be used to make kirby interpret the markdown?

Yes, if you use a texterarea field, you put valid standard markdown in the textarea field in the panel. if you use the the ->kirbytext or the shorthand ->kt on that feild in the php template, the markdown will get rendered as HTML.

So something like $page->mytextareafield->kt() will spit out html if the markdown in that field is valid.

But if its just bold / italic / adding a link you are after you might look at the Writer field, as thats wiswyg rather than having to know the mark down or those.

I prefer not to use the panel and haven’t even set it up yet—so if i’m filling in a text-based field in a .txt file, and i use markdown in it, do i just need to add ->kirbytext to the place in the php template where i call upon that field?

Yes thats right, that will render the textarea that has markdown / kirbytags and even raw HTML if thats in there too.

You can also use ->kt() instead which is less typing and does the same as ->kirbytext().

On a side note, you can also enable mardown extra in the config which give you more options.

https://michelf.ca/projects/php-markdown/extra/

perfect! thanks so much for your help : )