Preserve Whitespace in HTML Editor

(2)

Hello!

Chris Hofer has suggested several ideas for improving the HTML editor focused on increasing the readability of HTML code. I fully support his ideas. However, I want to suggest an option somewhat simpler, and that I think would have most of the same benefits for those of us who use the HTML editor regularly. Rather than automatic formatting of the HTML, I think it would be sufficiently useful if the HTML editor would simply preserve whitespace characters (spaces, newlines) put there by the person editing the page.

Currently, if one writes HTML into the editor and saves it, all of the formatting whitespace that one entered is stripped away when the HTML editor view is left. This renders the HTML exceptionally difficult to read, makes locating specific items within the HTML code harder than it needs to be, and results in a sub-optimal editing experience.

There is a workaround: retaining offline copies of pages as HTML files, editing those, and then copying/pasting the entire HTML source into the editor window. But this is a lot of extra work to keep edits synchronized between the two files. It would be easier if the Canvas HTML Editor would retain whitespace and allow the HTML to be formatted reasonably.

If this could be done, support for the tab key would also be nice to aid in formatting of the HTML.

As an example of what I mean, the first contains formatted HTML, and the second contains that same HTML after toggling from the HTML editor to the Rich Text editor, and back again. My idea is to make it so that the two images remain the same--the formatting from the first is retained in the second after leaving and coming back.

353181_Screenshot from 2020-07-16 16-37-58.png

353182_Screenshot from 2020-07-16 16-38-20.png

This is somewhat complicated by the generation of HTML due to edits made in the rich text editor. Personally, I would be fine if HTML generated by the rich text editor remains unformatted. Just so long as I can go in later, clean it up, and have the whitespace added by me in that cleanup process be retained. I do recognize that dealing with formatting the generated HTML simply returns us to Chris's suggestion referenced above of intelligent auto-indenting.

2 Comments
daveflip
Community Member
Comments from Instructure

As part of the new Ideas & Themes process, all ideas in Idea Conversations were reviewed by the Product Team. Any Idea that was associated with an identified theme was moved to the new Idea & Themes space. Any Idea that was not part of the move is being marked as Archived. This will preserve the history of the conversations while also letting Community members know that Instructure will not explore the request at this time.

ProductPanda
Instructure
Instructure
Status changed to: Archived
Comments from Instructure

As part of the new Ideas & Themes process, all ideas in Idea Conversations were reviewed by the Product Team. Any Idea that was associated with an identified theme was moved to the new Idea & Themes space. Any Idea that was not part of the move is being marked as Archived. This will preserve the history of the conversations while also letting Community members know that Instructure will not explore the request at this time.