Marko – A declarative, HTML‑based language

markojs.com

361 points by ulrischa 2 days ago


nolanl - 2 days ago

As someone who has actually worked on JavaScript frameworks, I think Marko is criminally underrated. The compile-time optimizations are extremely impressive: https://markojs.com/docs/explanation/fine-grained-bundling

I was not surprised for example that Marko came out very well in this performance comparison: https://www.lorenstew.art/blog/10-kanban-boards

tills13 - 2 days ago

It looks interesting and in a past life I probably would have tried it out but do you know why I like React? Because it's just JavaScript.

This `<let/variable=...>` and `<for ...>` syntax is awful.

mcny - a day ago

What I'm hoping to see in the future are:

1. native support for all http verbs such as put and delete in html itself without relying on JavaScript

2. sensible controls for drop down, select, multi select, date, time, datetime and so on without relying on any JavaScript

3. Submitting a form and submitting actions without reloading the whole page again without requiring any JavaScript

4. A whole lot of stuff yes without requiring any JavaScript

When I first heard the term htmx, I thought that was what htmx was but sadly it is just intercooler. What I am asking for requires broad support from browser vendors.

promiseofbeans - 2 days ago

This is actually quite cool - JS inside HTML, rather than the more React-y HTML inside JS.

As I understand it, Ryan Carniato was a major part of this project, and later went on to lead SolidJS, which goes back to the React style HTML in JS. Has he spoken at all about why he went back to that templating style?

abraxas - 2 days ago

After two decades of this churn we are back to the equivalent of JSP. It was the correct paradigm all along but millennials wouldn't be caught dead working with such a "lame" technology so they bestowed SPA on us and now they are slowly walking it back.

croisillon - 2 days ago

previously:

January 2023, 125 comments - https://news.ycombinator.com/item?id=34591625

August 2017, 150 comments - https://news.ycombinator.com/item?id=15057371

February 2015, 10 comments - https://news.ycombinator.com/item?id=9065447

ccpzza - 2 days ago

For those curious, the Marko team created a HN clone to showcase Marko 6

https://github.com/marko-js/example-hacker-news

lf-non - 2 days ago

This looks interesting and seems like a vast improvement over jsx.

I especially love the pug style concise syntax which for some reason they have buried deep into the docs rather than showcasing front and center.

https://markojs.com/docs/reference/concise-syntax

hyperhello - 2 days ago

The problem when taking several languages and mixing them together this way is that the result is supposed to have brevity, but it’s actually unreadable. You need slash to mean something grammatical, colon has to say something, you can speak “open brace” in a way that anticipates; @ means “at”. This code looks more like a compression scheme.

faldor20 - a day ago

I think it's worth noting Marko's proven nature.

In years of using eBay, have never had an issue with it. Sad that that's a high praise these days, but it is. eBay is fast, it works damn well, and always has.

As a counter point, React's poster children, in messenger, Facebook and Instagram. Have all been plagued with UI bugs for the entire time I've used them.

Obviously those aren't wholly comparable, but I do think it's worth taking note of the actual outcomes we have when tools are used at real scale.

hansvm - a day ago

I don't normally comment on formatting, but for a language I assume they're dog-fooding for the demo it's amusing that none of the gradient-backgrounded text renders visibly ("HTML-based", "building web apps", etc).

afavour - 2 days ago

Maybe just me but I actually think building web apps is already fun. I’ve got a hot reloading instant dev environment, I can publish to users in an instant… it’s great!

Looking at the Marko examples I feel the same way I do whenever similar stuff gets showcased: it’s trying to focus too hard on brevity and/or cutesiness and doesn’t seem like it would scale well to a full, complex web app. But maybe it’s not supposed to and maybe that’s fine.

React and Svelte and the rest can read clunkily at times but they have a clear separation of concerns and I’m glad for that.

brianzelip - 2 days ago

Here’s an informing recent DevTools podcast episode featuring someone from the Marko team, https://www.devtools.fm/episode/

jordanscales - 2 days ago

Looks absurd. Can't wait to try it.

andix - 2 days ago

I didn't look deep into Marko yet, but in my opinion JSX is by far the best HTML template language there is. And it's not restricted to React.

Most other template languages hits serious limitations really fast. I tried and hated (for non trivial things): Angular, Handlebars, Razor (dotnet) and Vue (which does support JSX optionally).

nielsbot - 2 days ago

Maybe off topic, but I’d kill for a HAML for TSX or Svelte!

Working with HAML really did make building web app fun IMO. I can’t be the only one!

shevy-java - 2 days ago

    <p>Today is ${new Date().toDateString()}</p>
    <p>Random number: ${Math.floor(Math.random() * 100)}</p>
Sorry, I don't like it. I already disliked that immensely in PHP. Not going back to that spaghetti mesh-up.

The intro is also incorrect in my opinion. It writes a "HTML-based language", but this is more a hybrid of HTML and JavaScript. Why is JavaScript not mentioned in the intro?

yilugurlu - 2 days ago

It reminded me of ColdFusion, which could be something better if it hadn't ended up in Adobe's hands.

pier25 - 2 days ago

This sort of stuff is just a big nope:

    <let/count=0>
Why make a special language? Just use HTML and TypeScript that will be compatible with editors, tooling, etc. This is the same mistake Imba made.

It's a shame because the core of Marko looks phenomenal: streaming, fine-grained bundling, rendering performance, etc.

Also not sure about the file-based routing of Marko Run. That was a big reason why I abandoned SvelteKit.

AbstractH24 - 2 days ago

There’s some joke here about how that’s in contrast to Marketo…

ifh-hn - 2 days ago

I wonder how this compares to htmx, seems similar though obviously different in terms of approach. I'm getting a little jQuery feels too.

didip - 2 days ago

Honestly, why not just put Scheme on the browser.

Scheme is capable to represent HTML JS and CSS all in 1 language.

mobeigi - a day ago

I love the landing page for this project. It's very engaging.

Antwan - a day ago

The new jquery? Eurk.

senfiaj - 2 days ago

Honestly I don't know... I'm somewhat skeptical about these "next big thing that will fix all your pains in web development". There is so much fragmentation in JS libraries / frameworks. Angular, React, Vue, Svelte, Asto, SolidJS, NextJS, Nuxt, Qwik... The list is so overwhelming. Almost each one claims that it fixes a problem in other framework, and a year later the other framework fixes that issue... I think it's better to stick to a big old player, such as Angular.

jm4 - 2 days ago

It looks like they reinvented ColdFusion for modern web apps.

debuggerpk - 2 days ago

abomination

bdcravens - 2 days ago

So .... ColdFusion?

cubefox - a day ago

It's misleading to call this "A declarative, HTML‑based language" when it in fact relies heavily on writing explicit JavaScript (which is very different from HTML and not declarative at all).

Something like htmx does come a lot closer to being a HTML‑based language in my opinion. So much so that you could add it to the actual HTML spec.

(That's not to say that Marko is bad, just that it's more a way to mix HTML and JavaScript in a more intuitive way rather than a declarative, HTML‑based language.)

- 2 days ago
[deleted]
mattw1 - 2 days ago

Dear front end devs

Please chill w making new languages and frameworks that re-solve solved problems. The internet is working fine as it is.

Warmest regards, Matt

rapish62 - a day ago

[dead]

wauwboer - 2 days ago

[flagged]

fuman - 2 days ago

[flagged]

davexunit - a day ago

I personally do not want to write HTML and I especially do not want to encode logic into it. This wave of HTMX-likes has some interesting ideas but encoding it all into HTML just feels so wrong to me. JSX is likewise awful. We need real programming languages here.