Set a proper "lang" attribute on <html> · Pull Request #1481 · hackmdio/codimd
This pull request fix the issue that lang attribute are always set to "en" no matter which language the user are using.
For YAML metadata tag lang, according to the document, its default value is en. Since we now override the lang attribute on <html>. I changed it to always set lang to en when there is no lang in YAML metadata.
Setting up a proper lang attribute is very necceserry for a11y. Since some screen reader like VoiceOver on iOS/macOS will relying on lang attribute to detect content language.
Also I fixed a bug where the lang/dir attribute keeps unescaped in HTML exported page. This bug also exists in HackMD.io. Literally, this is a XSS bug but it only run on file:/// so I don't think it's critical.
Related to Issue: #87
P.S. I'm aware that default lang attribute for notes should be set in the server configuation. But I'd like to keep it in the future discuss now.