dream-html
gron

dream-html | gron | |
---|---|---|
13 | 67 | |
174 | 13,982 | |
4.0% | 1.1% | |
9.2 | 2.2 | |
16 days ago | 3 months ago | |
OCaml | Go | |
GNU General Public License v3.0 only | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
dream-html
- The Future of Htmx
-
Constructing XML output with dream-html
FOR some time now, I have been maintaining an OCaml library called dream-html. This library is primarily intended to render correctly-constructed HTML, SVG, and MathML. Recently, I added the ability to render well-formed XML markup, which has slightly different rules than HTML. For example, in HTML if you want to write an empty div tag, you do:
-
Hypermedia Systems
htmx is a JavaScript library which interprets a set of HTML attributes and JavaScript events. It doesn't have anything to do with static typing. However, it's fairly easy to add a statically-typed layer on top of it eg https://github.com/yawaramin/dream-html
- Dream-HTML – render HTML, SVG, MathML, Htmx markup from OCaml
-
A Response to "Have Single-Page Apps Ruined the Web?"
There is some truth to this. Imho the next level of htmx is unlocked when you componentize everything like a React app...but with nested routes corresponding to nested components like a Remix app...and using an HTML generation DSL embedded directly in your language, so HTML becomes a first-class citizen of your language's constructs, rather than a templated afterthought. I have a demo of this: https://github.com/yawaramin/dream-html/tree/todoapp/app
-
Second-Guessing the Modern Web
Nowadays I highly recommend HTML embedding libraries directly in the programming language. E.g. ScalaTags https://com-lihaoyi.github.io/scalatags/ or (my own) https://github.com/yawaramin/dream-html
Yes, you give up the ability of designers and frontend-only people to easily work with the HTML templates. But in exchange you get quite a lot.
-
That people produce HTML with string templates is telling us something
I found your article very informative and it matches up quite a bit with my own thinking about HTML generation. In fact it looks like we independently arrived at pretty much the same conclusions. A lot of the issues you raise are the impetus behind the way I designed my HTML-generation DSL: https://github.com/yawaramin/dream-html
-
What's the most htmx-ish language for the server side?
I am developing an HTML generation library on top of Dream, to have great support in the language including htmx support: https://yawaramin.github.io/dream-html/dream-html/Dream_html/index.html
- dream-html: Generate HTML markup from your Dream backend server
-
My Thoughts on OCaml
Look at this code which prints out an HTML tag: https://github.com/yawaramin/dream-html/blob/main/lib/dream_...
Initially you might think generating HTML tags from data structures in code should be a simple matter. But there are complexities--some tags are defined as having no child tags, others do. Some tags are purely character data (unstructured text), not structured data. Some are just comments. We need a way to compose multiple tags together into a single 'virtual' tag for flexible HTML generation. All these conditions can be pretty hard to keep track of--unless your compiler does exhaustiveness checking. Then the compiler will tell you if you missed any cases.
In the example above I didn't make any manual effort to cover all the cases, I simple listed out the cases I wanted to handle in order. The compiler made sure that I didn't miss any.
gron
-
Greppability is an underrated code metric
It's ofter a matter of having the right tool for the job. In your case, https://github.com/tomnomnom/gron might be useful.
-
TomWright/dasel: Select, put and delete data from JSON, TOML, YAML, XML and CSV
Speaking of trees, gron/ungron is an amazing transformer that allows one to use any query tool on the leaves of the tree and then turn the flattened structure back into a document (json).
I'd love to see gron/ungron implemented for all tree structures.
https://github.com/tomnomnom/gron
-
Frawk: An efficient Awk-like programming language. (2021)
gron (https://github.com/tomnomnom/gron) to transform it and query and then invert the transformation?
- Show HN: Flatito, grep for YAML and JSON files
- Gron: Make JSON greppable
-
Make JSON Greppable
It buffers all of its output statements in memory before writing to stdout:
https://github.com/tomnomnom/gron/blob/master/main.go#L204
- Ask HN: What are some unpopular technologies you wish people knew more about?
-
Jaq – A jq clone focused on correctness, speed, and simplicity
Have you tried `gron`?
It converts your nested json into a line by line format which plays better with tools like `grep`
From the project's README:
▶ gron "https://api.github.com/repos/tomnomnom/gron/commits?per_page..." | fgrep "commit.author"
json[0].commit.author = {};
json[0].commit.author.date = "2016-07-02T10:51:21Z";
json[0].commit.author.email = "[email protected]";
json[0].commit.author.name = "Tom Hudson";
https://github.com/tomnomnom/gron
It was suggested to me in HN comments on an article I wrote about `jq`, and I have found myself using it a lot in my day to day workflow
-
Interactive Examples for Learning Jq
> So all I want is a tool to go from json => line oriented and I will do the rest with the vast library of experience I already have at transformations on the command line.*
The tool for that is likely https://github.com/tomnomnom/gron
-
Modern Linux Tools vs. Unix Classics: Which Would I Choose?
If JQ is too much, see GRON &| Miller
gron transforms JSON into discrete assignments to make it easier to grep for what you want https://github.com/tomnomnom/gron
Miller is like awk, sed, cut, join, and sort for data formats such as CSV, TSV, JSON, JSON https://github.com/johnkerl/miller
What are some alternatives?
htmlgo - A library for writing type-safe HTML in Golang
xidel - Command line tool to download and extract data from HTML/XML pages or JSON-APIs, using CSS, XPath 3.0, XQuery 3.0, JSONiq or pattern matching. It can also create new or transformed XML/HTML/JSON documents.
litestar - Production-ready, Light, Flexible and Extensible ASGI API framework | Effortlessly Build Performant APIs
fx - Terminal JSON viewer & processor
literal-html - Simple and unsafe HTML/XML templates for TypeScript, using tagged template literals
jq - Command-line JSON processor [Moved to: https://github.com/jqlang/jq]
template - A simple framework for webapps
miller - Miller is like awk, sed, cut, join, and sort for name-indexed data such as CSV, TSV, and tabular JSON
rum - Simple, decomplected, isomorphic HTML UI library for Clojure and ClojureScript
JsonPath - Java JsonPath implementation
typedef
zsh-history-substring-search - 🐠 ZSH port of Fish history search (up arrow)
