screwlisp proposes kittens

This is just aral’s fragment.md markdown example for the kitten web framework.

I was not using Kitten well up til now. I was just writing markdown files. Kitten itself is well thought out. I think the best structural feature is markdown fragments with named slots. The other best feature is probably the way that data connects with websockets with explicit reference to Ted Nelson on the topic. Here I will just do Aral’s tutorial about the former, which is tucked away quite deeply into the tutorials for such a fundamental piece. This is my attempt to finally figure some core useage out.

One markdown Fragment

I named this Eg1.fragment.md. I named the kitten defragging. So this is in path/to/my/defragging/md/Eg1.fragment.md.

# __${SLOT.title}__

> Date: __${SLOT.date}__

foo

'''
${SLOT.body}

${SLOT.body}
'''

bar

I put ‘’’ for the inner code-block-```s.

Kitten page using that markdown fragment.

In path/to/my/defragging/md/index.page.js. The dynamic page generation uses serverside js. It generates sanitized static html. Kitten is exceptional in its strictness about not being or enabling abusive javascript: On the other hand, lots of html generation tools are javascript because it is the web programming language. Like I mentioned the Nelsonian websockets seem important too. For now, just making composite markdown pages out of markdown fragments.

import Eg1 from './md/Eg1.fragment.md'

let eg1date = 'My Eg1 date'

export default () => kitten.html`
    <page css syntax-highlighter>
<${Eg1}>
<content for='title'>My Eg1 title</content>
<content for='date'>${eg1date}</content>
<content for='body'>My Eg1 body</content>
</>
After my Eg1 body
<${Eg1}>
<content for='title'>Using my Eg1 fragment</content>
<content for='date'>again</content>
<content for='body'>to build one composite markdown page</content>
</>
`

Whence.

cd path/to/my/defragging/
kitten

(kitten), seen in the popular but anticorporate librewolf firefox fork.

We used one fragment twice with a mixture of inlined content and data (the let eg1date = 'foo') to dynamically generate markdown, sanitized and rendered into html in the usual markdown way. The most powerful position for our data will be in the kittendb application database, with live websockets connecting it to a browser so that we are always seeing (and perhaps affecting) the true application state. Though it renders fine statically in a non-javascript web browser: It is just you would need to reload to discover data changes.

Conclusions

Markdown fragments reuseably generating composite rendered markdown pages from live data seems really powerful. This article is part of me figuring it out, but I am quite excited to apply this sophistication to https://screwlisp.small-web.org.

Fin.

Seasons greetings. (It being Dec 25th today).

See you on the Mastodon for your thoughts.

screwlisp proposes kittens