Page 1 of 1

DONE: Could syntax highlighting for htmx and _hyperscript be implemented?

Posted: 14 Jun 2023 21:13
by bprlhe
Their websites are htmx.org and hyperscript.org. As I know there are syntax highlighting already available for VSCode and Sublime Text.

Re: Could syntax highlighting for htmx and _hyperscript be implemented?

Posted: 20 Jun 2023 08:28
by pjj
Do you think it's worth trying? According to htmx author's own words, htmx is over.

...Okay, okay, it will be back in the afternoon, as always is. (For those of you who don't follow @htmx_org on Twitter, htmx is regularly "over", only to be "back" in a couple of hours/days later, with new logo and new memes. It is just an injoke, the technology itself is very interesting, and the progress is stable.)

What is htmx?
htmx is a library that allows you to access modern browser features directly from HTML, rather than using javascript.
https://htmx.org/docs/
Instead of JSON, it imports HTML chunks from the server and inserts them into DOM (true REST approach).

htmx code may look like this:

Code: Select all

<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<button hx-get="/confirmed"
        _="on htmx:confirm(issueRequest)
             halt the event
             call Swal.fire({title: 'Confirm', text:'Do you want to continue?'})
             if result.isConfirmed issueRequest()">
  Click Me
</button>
(from https://htmx.org/examples/confirm/)

There is indeed hyperscript syntax highlighting for Sublime Text. Highlighted htmx code looks like this (basically it is highlighting inside HTML attributes values):
Image

I think it would be a valuable enhancement to RJ TE. Keywords are listed in one of these files at Github, however being able to use Sublime's syntax files verbatim would be even bigger win for RJ TE.

Re: Could syntax highlighting for htmx and _hyperscript be implemented?

Posted: 28 Jun 2023 18:36
by Rickard Johansson
Will be added in the next release (v15.91). Thanks!

2023-06-28_193452.png
2023-06-28_193452.png (20.62 KiB) Viewed 2910 times

I may still make some minor changes, but it seems to be working properly...

Re: DONE: Could syntax highlighting for htmx and _hyperscript be implemented?

Posted: 28 Jun 2023 18:48
by pjj
Yay! htmx all the way!
Image