Open TailsFanLOL opened 3 months ago
Doesn't the HTML syntax highlighting (you can try it with setlocal filetype html
) work for XHTML too? Or do you mean that you would like some XHTML specific file extension(s) to be automatically detected as HTML?
It does work, but XHTML has a much stricter syntax. For example, all tags must be closed with no exceptions, attributes must be lowercase, attributes must have a value, etc.
It does work, but XHTML has a much stricter syntax. For example, all tags must be closed with no exceptions, attributes must be lowercase, attributes must have a value, etc.
Micro's syntax highlighting system is based on regular expressions and thus not advanced enough to pair (nested) tags or do any other kind of advanced syntax analysis. I guess the syntax highlighting could help with some simple things such as only coloring lowercase attributes that end with a '=', but in general you would be better off using a linter (or a language server) to catch mistakes. As far as I know the HTML syntax should be a superset of XHTML syntax and as such sufficient to highlight any correctly formatted XHTML file.
That said if you do want to give making a bespoke XHTML syntax a go the html.yaml syntax would be a good starting point. Just copy the contents of that file to ~/.config/micro/syntax/xhtml.yaml
and start hacking! The system is rather simple, you don't need any programming experience (besides the basics of regular expressions). You could then either publish it as a plugin or make a pull request to try and get it merged to the editor.
Description of the problem or steps to reproduce
I want an XHTML syntax highlighter. Shouldn't be that difficult to implement. Currently it defaults to XML.
Specifications
Commit hash: doesn't show, OS reports 2.0.9-1ubuntu0.22.04.2, but I took my time to look through the syntax files in this repo to make sure there's no such thing that I want right now. OS: Ubuntu Jammy Terminal: Alacritty