PublicisSapient / enable-a11y

MIT License
11 stars 5 forks source link

Refactor: Code Highlighting Widget (showcode.js) #109

Open zoltan-dulac opened 1 month ago

zoltan-dulac commented 1 month ago

The Code Walkthrough component that we use on almost all pages of Enable should really be refactored. Currently, the HTML is rendered on page, and then we use regular expressions against that HTML to highlight the important parts of the code. This results in some really hacky regexes to handle more complex situations.

A better way to do this would be to use CSS selectors to handle the highlighting, and then render the HTML so that those elements that match the CSS selectors are highlighted. This would result in the highlighting to be easier to do for people trying to document code walkthroughs.

showcode.js would have to be totally rewritten, I think.