This is question to users and developers: I am thinking about creating a dedicated Quicklook module for macOS to preview Kirby text files. Is there any interrest for that?
Some background: The website https://www.projectwizards.net is of course based on Kirby. We are not using the panel for several reason, instead for us everthing is based on a text file. Internally we have designed a nice workflow using a local test website, a Git repository and BBedit as the text editor.
Now I am challenged that some external people will write articles (mainly Blog & FAQs) for us. This means they will have no access to our Git and no preview of the local test website. The workflow itself is one thing, which is discussed separately. I’d like to focus on the preview now.
There are some Quicklook modules our there like qlmarkdown and others (https://github.com/search?q=quicklook+markdown) which provide the formatted view on a markdown file after selecting the file and pressing the space bar, I am sure the Mac users of you does know this.
I am thinking now to fork one of the projects and develop a dedicated KirbyText-Quicklook. Now I can repeat my questions: As some of you are developers who build solutions for your customers (like @lauri does it for us) and some of you are end users who utilize Kirby for their website. Who is not using the panel and would like to see a KirbyText-Quicklook module?
Sorry for the lengthy post
I think main problem is which bit of the file do you preview exactly? I think you will have a hard time making it useful to everyone, since field names can change. However, in theory, you could make a custom route on the site that generates a PNG of the page as seen in the browser, and show THAT in the quicklook instead. Then you just have to find the corresponding page on the website based on the file name and the folder structure. How easy that is I dont know.
Just some thoughts.
Thanks for your answer.
I agree, the flexibility of the structure of a Kirby text file is a curse and blessing. Currently our file look like this (an mini example from a FAQ):
Title: What is a project?
Subtitle: The definition according to the PMI
SEOtitle: [if given]
SEOdescription: [if given]
A project is a temporary [… bla bla bla …]
Product: merlin-project, merlin-project-express
Tags: faq7201, glossary, project
My idea is to display the the for set of tags as a block of keys and their values. Then the “Text:” will be displayed as expected (fonts & stiles) and at the end the final tags as well as a block.
Creating a PNG is a very huge thing as you have to have a fiel web server in that plugin, which is not very economical
Well i did some digging around and found QLCommonMark… the bonus is that it uses stylesheets to make it look right. This is Bootstrap by default, you could swap it for your sites css i think.
The main issue you have is plugins like this are expecting a file with
.md extension, not
.txt. You would have to get around that somehow.
In the meantime ive thought of a compromise. Im guessing you probably use something like dropbox or whatever to sync the changes back and forth, which means the editors have the contents of the content folder locally? If thats the case, you can get close to what you want by getting kirby to generate a webloc or a url file via a hook, and save it alongside the text file. Shouldn’t be too hard at all. Weblocs (url files too i think) can be previewed already in quicklook and spotlight.
If you put this in a textfile, and save it as
kirby.webloc you will see that quicklook quite happily shows the get kirby site… would take minutes to create that with a hook.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
The nice thing with that is that if they double click the webloc, it will bring up the page they just edited in a browser so they can see it.