Improved yaml syntax highlighting

This commit is contained in:
Mia Rose Winter 2024-03-25 12:13:21 +01:00
parent 63f6dd4bcb
commit f518098b07
Signed by: miawinter
GPG key ID: 4B6F6A83178F595E

View file

@ -11,17 +11,16 @@ public class YamlLanguage : ILanguage {
public string CssClassName => "yml";
public IList<LanguageRule> Rules { get; } = [
new LanguageRule(@"(?:\w+):", new Dictionary<int, string> {
{0, ColorCode.Common.ScopeName.XmlAttribute}
new LanguageRule(@"(?m)^\s*(#.*)$", new Dictionary<int, string> {
{1, ColorCode.Common.ScopeName.Comment}
}),
new LanguageRule(@"#(?:.*)\b", new Dictionary<int, string> {
{0, ColorCode.Common.ScopeName.Comment}
new LanguageRule(@"(?s)^(.+)(\-\-\-)", new Dictionary<int, string> {
{1, ColorCode.Common.ScopeName.XmlCDataSection}
}),
new LanguageRule("[^\\\\]\"(?:.*?)[^\\\\]\"", new Dictionary<int, string> {
{0, ColorCode.Common.ScopeName.String}
}),
new LanguageRule(@"\-(?:\s\w.+)\b", new Dictionary<int, string> {
{0, ColorCode.Common.ScopeName.XmlAttributeValue}
new LanguageRule("""(?m)^\s*(.+:|\- .+)( ".*")?( .+)?""", new Dictionary<int, string> {
{1, ColorCode.Common.ScopeName.XmlAttributeValue},
{2, ColorCode.Common.ScopeName.String},
{3, ColorCode.Common.ScopeName.XmlAttribute}
})
];