Simple Alternatives to the Built In HTML Editor

I don’t use the editor very often and when I do I’m doing very simple things. The new inline editor is driving me nuts. My 65 year old eyes have a hard time reading all the multicolor text against a black background. I don’t know what it means and I don’t want to learn, and and I can barely read it anyway. The HTML now includes a bunch of confusing % signs and numbers that weren’t there before.
Also closing the new editor drives me nuts as I have to keep fighting ten years of muscle memory to not hit Esc and close the entire window.

Can you elaborate on your use cases for the HTML editor? If you don’t want to learn HTML, one would think there’d be little to no reason to open it anyway :thinking:

4 Likes

I am a retired software engineer who has written or debugged a lot of HTML. I never had any trouble with working with monochrome HML text. Multi-color display only helps people who need help with HTML syntax—people who shouldn’t be editing it anyway. For the rest of us, it just gets in the way.

OK, I should speak for myself—for me (and apparently for pschroeter), it is counter-productive.

And, for what it’s worth, more than one empirical study has shown that dark text on light background is more readable than the reverse.

I believe most developers (experienced or not) actually prefer syntax highlighting :slight_smile:

But I also prefer dark text on light background.

4 Likes

I can understand if people prefer a simpler HTML editor, but this:

… is just gatekeeping. How would anyone learn anything if they were only allowed to do it once they’d mastered it? Editing HTML is not open-heart surgery. :wink:

4 Likes

No need to have “mastered” it before using it, but editing in Anki is not the best place to practice before learning at least a little.

Actually, I don’t think it helps beginners. Yes, it’s not surgery or rocket science. I learned it without having to first learn the meaning of a bunch of colors. Should people who only see shades of gray have to avoid editing? I find colors get in the way in every language I’ve worked in. I turn them off in IDEs and editors that are otherwise good. If they can’t be turned off, I don’t use the app. If I don’t have a choice, I paste the code into a simpler editor and paste it back when finished.

To each his own.

I think a black (+colors) on white color scheme does make sense for light-mode Anki, as it’s somewhat standing out in its current state. CodeMirror has wide support for different themes, so why not utilize them :slight_smile:

@WGroleau You might find the colors on white not quite as striking / distracting (e.g. look at this example)

The HTML now includes a bunch of confusing % signs and numbers that weren’t there before.

This is caused by URL encoding, which is (for example) done on the src attributes of images. This does not affect browser search however, you can still search for the cards with normal spaces.

4 Likes

Well, I’m not not “most developers” and after some of the stuff I’ve had to fix in my thirty-plus years, I’m not embarrassed by that.

Since you’re not most developers, you’ve certainly thought about this already, but here’s a workaround that took me 5 minutes (so you’ll likely make it in 2):

Override the styling of the HTML editor with your own CSS:

.CodeMirror-line  * {
    background: transparent !important;
    color: var(--text-fg) !important;
}

image

This is using the build after the following PR Use light theme CodeMirror in light theme Anki by hgiesel · Pull Request #1578 · ankitects/anki · GitHub
1 Like

I haven’t seen any coloring, but if I ever do, I won’t need two minutes, since you’ve already done it. But, looks like you know how to do separate CSS files, so why embed CSS in the HTML tag?

I don’t really see the point of this discussion. There is no real feature proposal, it’s more like complaining about how most modern IDE work out of the box…

1 Like

I’m afraid I don’t understand what you mean by that. I thought you were arguing against the colored syntax highlighting of Anki’s current HTML editor?

I would never do that purposefully, this was meant as an example, since copy-pasting and editing content often leads to the inclusion of inline-styles.

It has led to a PR for a separate HTML editor theme in light mode, so there was some point to it. But yeah, I thought we were responding to complaints about Anki’s editor, not syntax highlighting in general.

@WGroleau now that you know how to turn it off (when you’ve updated to a more recent version), I think can all be happy :slight_smile:

1 Like

I have the latest version. I have seen the coloring in the browser for my image fields. Since it’s merely a one-line image tag, it doesn’t cause vary much of a problem. Glad to see it is NOT used in the CSS window for editing card templates.

Would syntax-coloring be so disturbing to you?

I got thousands of flashcards for, math, science, and history. I didn’t need to try to learn HTML till I started to use Anki over a decade ago.
I’m not COMPLAINING about how modern “IDE” (An abbreviation I had to look up) work, I’m ASKING if anyone has created an alternative which is easier to read with my 65 year old eyes.
If there is one thing I wish Anki would do over the years, I wish it would become completely WYSIWYG like Word so I never have to peek under the hood.

That’s understandable. Ideally, all aspects of the software should be accessible to anyone, with or without coding skills.

However, a major appeal of Anki is how easy it is to peek under the hood. That’s why there are so many great add-ons for it and that’s why it’s unmatched in terms of versatility.

2 Likes