Show HN: A WYSIWYG word processor in Python (codeberg.org)

by chrisecker 38 comments 91 points
Read article View on HN

38 comments

[−] fractallyte 35d ago
One feature missing from almost every mainstream word processor: REVEAL CODES! (https://kb.corel.com/en/127364)

This is a famous "killer" feature from WordPerfect: the ability to view and edit the low-level formatting for a document. It's invaluable for fixing weird bugs.

However, it works only because WP uses the "text-stream" paradigm, where a document comprises a linear stream of text with formatting codes (Bold, Font, Hard Return, etc.) embedded directly at the point at which they're applied.

In contrast, Word uses the "nested containers" model (characters inside words, words inside paragraphs, paragraphs inside sections, etc.), where this feature can't be replicated.

I didn't look closely at your code, but just thought to mention this feature.

[−] nomdep 34d ago
I don't see why the "nested containers" model would prevent this feature to be replicated, it's just a tree of nodes. Not edit-this-as-plain-text-simple but almost.
[−] chjail-11 35d ago
I adore anything that avoids using a browser. <3
[−] vishnuharidas 35d ago
This took me down the nostalgic memory lane of the planet-source-code days. There were hundreds of such projects in Visual Basic, Delphi, C/C++/MFC etc., and text editors and paint clones were the most popular projects.
[−] Georgelemental 35d ago

> - Real WYSIWYG editing (no HTML layer, no embedded browser) with styles, images and tables. > - Clean, simple file format (human-readable, diff-friendly, git-friendly, AI-friendly)

Very nice! Unfortunately, the UI menus seem to be broken when using a dark-mode GTK theme (e.g. Adwaita Dark).

[−] chrisecker 34d ago
Yes, I can see what you mean: There are hand coded colors together with system colors. With the dark mode this gives white text on white background for the side panel. Thanks for mentioning.
[−] mttpgn 35d ago
On MacOS, I'm seeing ModuleNotFoundError: No module named 'miniword.core.utils' whether I run python3 -m miniword from src/miniword/ or from src/miniword/miniword/.
[−] chrisecker 35d ago
My mistake. Now it works (on linux).
[−] mttpgn 35d ago
Thanks, and I got the main window open now, but I'm getting a second error that doesn't look OS related. Plugin error (txtfilter.py): No module named 'miniword.importexport'
[−] chrisecker 33d ago
Fixed it. Thanks for reporting.
[−] emanuele-em 34d ago
Tables and images are the part where every "just use a rope" answer falls apart, so going B-tree feels right. I tried building a minimal rich text editor last year and got stuck exactly at the point where tables stopped being attachable as metadata and needed to live in the structure itself, ended up shelving it. Good to see someone actually push through it.
[−] antisol 32d ago
You had me at "non-HTML-based" ;)

I've been looking for a simple word processor that will let me easily/quickly do basic things and which will let me export to markdown and HTML that isn't terrible like the type word processors create.

I recently found wordgrinder (https://github.com/davidgiven/wordgrinder), which is a terminal-based word processor that's very close to what I've been looking for. A wx-based thing like this might be a bit nicer. So I'll start with one suggestion: support for wordgrinder's .wg format would be real nice :)

[−] analogpixel 35d ago
at this point, a WYSIWYG just seems like a huge step backwards from just using markdown. I love having access to my files in a standard text format this is super easy to parse, and not being locked into whatever weird format that WYSIWYG decides to store it in.

I still don't understand why people still use ~~Microsoft Word~~Copilot document writer , I think they have gotten into some weird mindset that their documents require all this weird unnecessary formatting to look "official"

[−] httpsterio 35d ago
Markdown without formatting isn't usually the nicest to read imo. I actually appreciate a well laid out and formatted document myself.

Also wysiwyg doesn't mean it can't be back and forwards compatible with markdown, it might just mean that it's a markdown editor gui with a preview.

[−] loloquwowndueo 34d ago

> at this point, a WYSIWYG just seems like a huge step backwards from just using markdown.

Not for a layperson. There’s a reason WYSIWYG word processors completely obliterated the previous “needs an explicit preview mode” generation ones.

[−] netbioserror 35d ago
My prolific Typst use, along with quickly improving side-by-side editors like Typesetter, are rapidly diminishing (in my eyes) the reasons for WYSIWYG to be. Sure, normies need it, yadda yadda. Is it worth the staggering cost? The file format and GUI complexity?
[−] sakesun 35d ago
Yes. These days, with plain text, pasrsers, Internet, mobile devices and LLM, we really get more than what we see. Only few case where paper print out is still more useful.
[−] pjmlp 34d ago
That is only for techies. WYSIWYG has won for a reason.
[−] kubb 35d ago
I thought the data structure part is solved:

https://en.wikipedia.org/wiki/Rope_(data_structure)

[−] LoganDark 35d ago
Love to see wxPython!
[−] pbronez 35d ago
Check out Typst. It’s a markup language focused on print with HTML layout as a secondary target.
[−] __d 35d ago
This is great!

Curious about the choice of toolkit: what led you to wxPython?

[−] subdomain 35d ago
I love seeing new word processor projects!
[−] avryhof 35d ago
Looks like a nice project.

Looks like you missed a file, though.

ModuleNotFoundError: No module named 'miniword.core.utils'

I don't see it in my local clone of your repo, nor the repo iteslf.

[−] kabir_daki 35d ago
[dead]
[−] johnwhitman 35d ago
[dead]