Use parsed contents of markdown (.md) file in page body

I kind of asked this in another thread but in relation to HTML, sorry for the semi-duplication but I would really like to get this resolved.
I have a piece of software that spits out a .md file and a load of images.

I would rather not have to copy and paste the contents of the markdown file into a text field in the panel. What I would like to be able to do is add the markdown file to a page and have kirby parse the contents. This file will have no front matter, the contents is purely for the main body of the page. I am aware you can do this:

c::set('content.file.extension','md');

but it isn’t what I need.
I understand I will need to use kirbytext in order for the images to show correctly?

This is the last major hurdle for me with my first Kirby site which has otherwise been a great experience.

Thanks in advance

You can do the same thing as in the other thread, but use the markdown() helper function on the file contents to get a HTML value.

Note that this works well if your Markdown is generated by other software or if you intend to modify it by hand. If you plan to edit it with the Kirby Panel, I’m afraid it’s not going to work out that well (or at the very least you would have to make a custom field to manage reading from and writing to that separate file; might be doable, but not trivial).

1 Like