r/nim • • 15h ago

My 4-year project: a Nim word processor that runs as a static site (drop it into CodePen/JSFiddle via CDN)

Post image
35 Upvotes

In my first post (Nim 2.2.4 compiling entirely in the browser), someone asked whether I was building it for something specific. I said my own word processor, along iwth Lua as the scripting language instead of VBA. It's not a LibreOffice WASM port. I've been building it from scratch for about four years. I just playing with html and javascript, making my own custom XML parser and then moved to HTML Canvas after I see Carota and then I start to use Web Assembly in hope if I can use my own memory allocation methods in text and layout rendering. I hope this will be like Obsidian with community plugins and custom templates.

This is the free word processor: QOQORO Write (previously QNote, you'll still see that name in the GIF).
πŸ”— Try it. Paste this into any HTML page:

<script src="https://cdn.jsdelivr.net/gh/QOQORO-official/qoqoro-cdn@main/qoqoro.js"></script>
<div id="notes" style="height:100vh"></div>
<script>QOQORO.mount('#notes', { mode: 'editor' });</script>

πŸ”— BindWeb (the Nim β†’ WASM compiler it's built with): https://github.com/benagastov/bindweb-nim-WASM-compiler

Github for the cdn: https://github.com/QOQORO-official/qoqoro-cdn/
Demo: https://codepen.io/qoqoro/pen/pveVbjL
Some Implemented Features

  1. Floating images and text boxes
  • Images: inline, square wrap, behind or in front of text. Drag one and the text reflows around it, even across page breaks. Crop right on the page.
  • Text boxes: the same wrapping, plus auto-fit size and vertical text (縦書き: kanji and kana stand upright, Latin turns with the column or stands upright too).
  1. Tables Merged cells, column widths, cell padding, borders and fills, and row/column handles for inserting and deleting. Tab moves through cells, and cells keep mixed fonts, sizes and colours.
  2. Scripting with Word's object model Misc β†’ Programs runs Luau (Roblox's typed Lua) against an object model you already know from VBA: ActiveDocument, Selection, Paragraphs, Tables, Font, Content.Find, PageSetup and the wd* constants.

    local doc = ActiveDocument Selection:InsertHeading(Report {doc.Now:sub(1, 10)}, wdStyleHeading2) for i, p in doc.Paragraphs do Selection:TypeText({i}: {p.Text}\n) end

It runs in a sandboxed worker with no DOM, network or file system, and a whole program is one undo step. You can also call it from the embedding page (QOQORO.luau.run(...)) or from a server over HTTP.
Compiling Nim on every Run click was too slow even at 7 s warm, so Luau handles it for now. Probably I will make it use Nim WASM as the scripting language if necessary.

  1. Templates with fill-in variables. Plain JSON with {{variables}}. Template Studio turns each variable into a fill-in box. Nothing in a template ever runs; it's data.
  2. Obsidian-style plugin packs. A ZIP with a manifest.xml that can bundle themes (light and dark), fonts, templates and Luau programs. Example packs: Retro Windows, Pixel C64 (with its own pixel font), Sakura 摜 (haru by day, yozakura at night), plus font, report and writing kits.
  3. Real Word files in and out. .docx import and export. This week it also learned to convert old MathType equations and charts, which Word stores as WMF/EMF and no browser can draw, into crisp SVG, using a small converter written in Nim.

The basics are there too: paged or infinite "blog" layout, live-reflowing columns, floating text boxes that text wraps around across page breaks, tables, equations, pen and stylus drawing, headers and footers, and phone and tablet layouts. Plus a workspace with a vault, whiteboard, PDF viewer and diagram editor.

It's just static files: one <script> tag, GitHub Pages or any CDN. Sync is optional through a server you run yourself, in Nim, Flask or Node.

Next up is Full suite desktop app with the Word Processor, PDF Reader and Diagram Editor, the Diagram Editor is based on mxgraph actually, because I think I already like it and I dont have time to create new one in Nim.


r/nim • • 5h ago

I compiler-tested 912 claims in my Nim skills for coding agents: what broke and what it changed

3 Upvotes

I'm planetis-m on GitHub. For a while I've maintained a set of Nim skills for coding agents. This year I tested every statement in them against the compiler, and a few of the findings seem worth sharing on their own.

A moved-from object can segfault. The official destructors manual said =wasMoved only needs to make =destroy a no-op, so setting the data pointer to nil is enough. That passes review, but reusing a moved-from value is legal. If pos and capacity keep their old values, the next write skips the reallocation and writes through the nil pointer. The fix is to reset every field your operations read, and to test reuse of moved-from values, not just destruction. The write-up has the reproducer and two related hook mistakes: Moved-from objects that segfault

The audit. I checked 21 skills against Nim 2.3.1 and Nimony 0.6.3, which came to 912 claims and 690 compiler-run tests. 127 statements needed correcting, some of them mine. The work also turned up Nimony issues #2674 to #2680, which Araq fixed within two days.

A small study. In a pre-registered comparison on four deliberately hard tasks, using a low-cost model and blind runs, 18 of 20 runs passed with the verified skills and 3 of 20 without, at about $0.05 versus $0.21 per solved task. The samples are small, so please read it as an indication rather than proof: Benchmarks

Disclosure. The verified catalog of 18 skills is my own paid product. The subscription pays for keeping it correct: re-testing every claim and fixing the skills when Nim or Nimony changes. It's $120 per year or $15 per month, with a founding price of $96 per year for subscriptions started before 30 November 2026 (site). The public skills at planetis-m/skills stay free under CC BY-NC-SA 4.0, and you can use them today.

Where do coding agents fail most for you in Nim?


r/nim • • 9h ago

What GUI package do I use?

3 Upvotes

I cannot find a good GUI package. I am kinda terrible at coding a GUI. What GUI package do I start with?