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

Discuss syntax highlighting or submit new syntax files.
Post Reply
bprlhe
Posts: 26
Joined: 01 Apr 2023 06:26

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

Post by bprlhe »

Their websites are htmx.org and hyperscript.org. As I know there are syntax highlighting already available for VSCode and Sublime Text.
User avatar
pjj
Posts: 2130
Joined: 13 Oct 2009 13:48
Location: Kraków, Poland

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

Post 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.
Alium tibi quaere fratrem; hic, quem tuum putas, meus est. Titus Flāvius Caesar Vespasiānus Augustus
User avatar
Rickard Johansson
Site Admin
Posts: 6628
Joined: 19 Jul 2006 14:29

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

Post 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 1715 times

I may still make some minor changes, but it seems to be working properly...
User avatar
pjj
Posts: 2130
Joined: 13 Oct 2009 13:48
Location: Kraków, Poland

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

Post by pjj »

Yay! htmx all the way!
Image
Alium tibi quaere fratrem; hic, quem tuum putas, meus est. Titus Flāvius Caesar Vespasiānus Augustus
Post Reply