frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Show HN: Making a markup language for my UI engine

https://gitlab.com/jylefv/CoshUI
1•jylefv•1h ago
I made a post about my UI engine "CoshUI" once before that never really gained any traction, so if this does well and people need an idea on what I'm talking about, here's the previous post:

https://news.ycombinator.com/item?id=48607858

Now back to topic, I've been working on a markup language for CoshUI specifically to make text easier to style. To set the stage, here's an example of how it works:

  cui.RichLabel(id="title", text="[bold color=(255, 0, 0) font_size=48]You Died![blue italic] Haha![/][/]", strikethrough=True) 
This renders "You Died" in bold, red, and a font size of 48 with "Haha!" being overridden to blue and having italic on top of the bold and font size, then the entire text gets a strikethrough due to it being set on RichLabel.

Before this update, I had a basic "Label" widget that had styling parameters and would render whatever was on the `text` field. Of course, as you can imagine, it's extremely limiting.

So I set out to create a system that fit with CoshUI's backend-agnostic-ness while also making it easy and viable to use. So I got to reworking how the text system worked.

My inspiration, Godot's RichTextLabel node, exposes BBCode. Which is the direct inspiration for "CoshML", the markup language for CoshUI's text. But one thing I didn't like about BBCode is that it only accepts one style per tag. So I looked at HTML and saw the concept of multiple calls directly in a single tag and sought to follow something similar.

When it comes to the implementation, I originally went with something like:

  [color=(255, 0, 0)]Hello[/color]
Which is pretty obvious, but see, if I sought to create multiple styles in one tag (e.g. [color=(255, 0, 0) font_size=28]), I'd need a universal closing tag instead of the named closing tag like BBCode or HTML.

The implementation I landed on was a stack system. It would put each style into a class, and append that class to the stack, then when the parser sees "[/]" (or the universal closing tag), it'll pop that style out of the stack in a LIFO manner. Basically:

  style_stack = [TextStyle(default_values), TextStyle(text_color=(255, 0, 0), font_size=28, inherited_values_from_higher_style)]
Then, each time there's text, it would just look towards the topmost style in the style stack, and append those styles to itself.

That's basically the surface-level explanation of how the parser works. What was tough was how to render text. Because CoshUI is backend-agnostic, I needed a unified way to render text in every backend. So what I did was separate text that had different styling to something called a "TextRun".

At least at the time, the idea was to render each TextRun in the backends. They'd iterate through each run, and they'd render them. It became more complicated once I remembered text wrapping and alignment.

The solution was to make another class called "LineLayout" which holds "TextFragment" classes. TextFragments would hold all the necessary styles for that specific text, while LineLayout would hold all the TextFragments for that line. It would all be derived based on the styles in TextRun. So an example would be:

2 lines, with 2 TextRuns. The text in the first TextRun goes from 0-39 in letter position, the second is 40-81. The first line is from 0-46 in letter positions, so it will create 2 TextFragments that have the styles in run 0-39, and 40-46. Then the second line will have a TextFragment from 47-81.

So with that, backends just iterate through LineLayout and render those TextFragments.

Now, is it perfect? No, very much no. But it doesn't stop me from being proud of what it can do. I've learned a lot while making this and I'd really like some advice and feedback on the project as a whole.

The next generation of ChatGPT Voice [video]

https://www.youtube.com/watch?v=9f-Ew_lDtxc
1•gurjeet•27s ago•0 comments

panSpeedCalc

https://phfx.com/tools/panSpeedCalc/
1•skibz•1m ago•0 comments

Show HN: Apposters – Generate a project website directly from a GitHub link

https://apposters.com/
1•loeona•2m ago•0 comments

Terminal Graph – Infinite Spatial Terminal Canvas

https://terminalgraph.com
1•wpm•2m ago•0 comments

How Personas Can Influence Agents to Play Split or Steal

https://arxiv.org/abs/2607.05398
1•Brajeshwar•2m ago•0 comments

Chat Control

https://en.wikipedia.org/wiki/Chat_Control
1•sharpshadow•3m ago•0 comments

Top contributors to Codex own 50% of the codebase by linecount

https://www.reddit.com/r/PrincipalAi/s/zfDdyPkQVz
1•fernando-ram•3m ago•0 comments

NetBird Launches Open Source Agent Network

https://github.com/netbirdio/netbird/tree/main/agent-network
1•techhut•3m ago•0 comments

OffHeap – An off-heap L1 cache engine for Node.js written in Rust

https://off-heap.vercel.app/
1•onlykgzin•3m ago•0 comments

A Reminder to Limit Thinking

https://press.asimov.com/articles/limit-thinking
2•rvialep•4m ago•0 comments

The computer is being reinvented in the agentic era

https://twitter.com/gregisenberg/status/2074287887466582072
1•redbell•4m ago•0 comments

Show HN: Copy the Code. Keep the Updates

https://useregraft.com/
1•dantelex•7m ago•0 comments

How we rebuilt Pydantic’s Rust Python interpreter as a Bazel remote build

https://zozo123.github.io/bazel-monty/
1•zozo123-IB-IL2•11m ago•0 comments

When easy is not enough

https://algodeck.com/simple-easy/
1•marukodo•11m ago•0 comments

BlackBear: Private Life Operating System

https://blackbear.app/
1•redmattred•11m ago•0 comments

The web is dead, what's next?

https://ashk.au/2026/07/07/the-web-is-dead-whats-next/
1•speckx•11m ago•0 comments

Bloom Energy's Big Lie

https://hntrbrk.com/investigations/bloom
2•jaredwiener•14m ago•0 comments

A full body MRI earns you a year of smoking

https://entropicthoughts.com/full-body-mri-earns-you-a-base-jump
1•kqr•15m ago•0 comments

A browser MMO snake where ~1000 players share one CPU core

https://growordie.io
1•ncakes•18m ago•0 comments

Crypto firms prepare defenses as quantum threat to encryption draws nearer

https://www.reuters.com/legal/government/crypto-firms-prepare-defenses-quantum-threat-encryption-...
1•tartoran•18m ago•0 comments

A Windows utility for a problem that kept stealing 10 minutes at a time

https://www.indiehackers.com/post/i-launched-a-windows-utility-for-a-problem-that-kept-stealing-1...
1•enlightpixel•19m ago•0 comments

An AI coal mine security camera network powered by plaintext passwords

https://eaton-works.com/2026/07/08/coal-india-camera-hack/
2•EatonZ•20m ago•1 comments

A jigsaw puzzle where every piece is a slice of live video

https://jumpcutjigsawpuzzles.com/
1•tjsbbi•24m ago•2 comments

Show HN: Runo – open-source web scraping that returns typed JSON

https://github.com/rhymeswithlimo/runo
1•barebearcountry•25m ago•0 comments

Meta AI glasses disable the camera if the capture LED is destroyed

https://9to5google.com/2026/07/07/meta-ray-ban-smart-glasses-privacy-light-camera-update/
3•p_stuart82•25m ago•1 comments

Show HN: Arbor – code graph MCP server so agents stop grep-reading your codebase

https://github.com/Anandb71/arbor/releases/tag/v2.4.0
1•anandb71•26m ago•1 comments

How to tell if a photo is AI-generated from its metadata (C2PA, XMP, EXIF)

https://photoinvestigator.co/blog/how-to-tell-if-a-photo-is-ai-generated-metadata/
1•Danbana•26m ago•0 comments

macOS 28 will not support encrypted HFS+ volumes

https://support.apple.com/en-us/125615
7•Lihh27•29m ago•0 comments

Be Grateful to Own Nothing

https://mkultra.monster/gaming/2026/07/03/physical-shmysical/
1•speckx•30m ago•0 comments

Ask HN: Software Engineering Guide – seeking recommendations

1•jph•30m ago•0 comments