Is it possible to replace a text in the editor area with HTML element?


#1

Hello. This might not be a best place to ask so feel free to redirect me somewhere else.
I would like to use the atom inside my personal project and I would like to have the functionality of having checkboxes inside the editor area.

Specifically if I have a following segment of text:
[] Do something
[] Do something else
[x] Did this

I would like that [] text is replaced by an unchecked checkbox element and that [x] is replaced by checked checkbox element in the editor.
Additionally would it be possible to have a functionality that checking on the checkbox will replace the underlying text with [] (for unchecked checkbox) or [x] (for checked checkbox).

I have looked at the Atom documentation but I did not see any extension points for this functionality. Markers and decorators seem like something which could be used for this but I could not find anything more in the documentation that could help me.

Is this even possible with current Atom extension model?
Would it be possible if I would be prepared to enter the core editor code and try to add the functionality by myself (I suspect that behind the editor is the Chromium editing functionality and I do not know if it would support this functionality)?


#2

Amazing things are possible with the Atom API. Take a look at the minimap or pigments packages for example. Both of these add visual elements to the editor view. On the other hand, neither of these alter the alignment of or overwrite items in the editor view.

Yes, when you add the possibility of rewriting the editor code then anything is possible.

I’m not sure what you mean by the “Chromium editing functionality”. If you mean the support that Chromium has for edit boxes in web pages, Atom’s editing capabilities do not use that code at all. Atom’s editor code is custom built for Atom.


#3

Hi, Thanks for the answer, I will check out the packages that you mentioned.


#4

May I suggest this package:

It cheats, in a way, but it’s pretty cool I think, so perhaps you might like it nonetheless.


#5

Oh, how did I even get by with out a package like that! I needed this and didn’t even think to try look for a package on it. Really simple and works great.

I think it would still be awesome if there was the option of typing ordinary ASCII, like above, to generate and modify the tasks. I wonder if that will integrate easily with this package or not, I’ll probably take a look into that.

I’ll add that to the todo list! :smiley: