Deprecated HTML tags such as <font> are used in Summernote
See original GitHub issueTags such as <font>
were deprecated many moons ago and are not supported in HTML5. I believe Summernote’s success depends on it producing the cleanest, minimalist and best practise HTML known to mankind.
steps to reproduce
- Write some text
- Use the font colour tool to change the text colour
- View the HTML and see the
<font color="#00ff00">example</font>
in all its glory
In this I would suggest <span style="color: #0f0">example</span>
should be used. I see that in other places Summernote does use inline styles like this so I think this should be consistent across the font colour styles too.
Whether or not <font>
works, this is a question of style and making Summernote not appear like one of the old-school text editors.
Issue Analytics
- State:
- Created 7 years ago
- Comments:18 (7 by maintainers)
Top Results From Across the Web
Deprecated HTML Tags - W3docs
Deprecated HTML Tag List ; <big>, Increases the font size by one conventional unit. CSS styles ; <blink>, Creates an enclosed text, which...
Read more >Deep dive - Summernote
Summernote automatically populates the font dropdown with the available fonts that are given on fontNames option. This includes the font set on the...
Read more >jQuery Summernote - Get text back into editor - Stack Overflow
Since v0.7.0 code() has been deprecated and removed (same story for destroy() method). You must use $(".summernote").summernote("code", "your text");.
Read more >HTML5 - Deprecated Tags & Attributes - Tutorialspoint
Deprecated Attributes Some attributes from HTML4 are no longer allowed in HTML5 at all and they have been removed completely. img and iframe....
Read more >JavaScript · Bootstrap
Only one plugin per element via data attributes. Don't use data attributes from multiple plugins on the same element. For example, a button...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I don’t know if someone needs an alternative, but I found one:
Using sanitizer works perfectly for me: https://www.npmjs.com/package/sanitize-html-react
And specifically for the font tag: there is an option to replace it:
here is a simple example (I am using React):
Setting flags: allowedTags: false, allowedAttributes: false allows all tags and attributes. If you need to allow only a specific set of tags and attributes, there are examples in the documentation.
I hope that would help some of you!
Best wishes, Reneta
This has been added to the Projects List, you can check the progress here https://github.com/summernote/summernote/projects/2