3 ms·
You could identify that as not a valid tag in a single pass and know that you should escape the < and > on it. For the implementation all the real HTML tags sh
by charcircuit 3y ago
You could identify that as not a valid tag in a single pass and know that you should escape the < and > on it.
For the implementation all the real HTML tags should be generated by the formatter and not originate from the original input. When formarring the valid tags get deleted from the input and everything else is properly HTML escaped.
As a primitive example imagine that the only HTML tags the formatter is able to output is <b> and </b> tags alongside HTML escaped text. That means it will be impossible for a script tag to ever be outputed by the formatter.