Highlighter: Use link highlighting for <head profile=""> attributes
This commit is contained in:
parent
0b0a728f42
commit
0f9b3ea798
1 changed files with 5 additions and 1 deletions
|
@ -37,7 +37,11 @@ export class Highlighter {
|
||||||
this.spans.push(Span.createFromRange(attribute, attribute.nameRange, Color.Attribute, Font.Italic));
|
this.spans.push(Span.createFromRange(attribute, attribute.nameRange, Color.Attribute, Font.Italic));
|
||||||
|
|
||||||
if (attribute.valueRange !== undefined) {
|
if (attribute.valueRange !== undefined) {
|
||||||
if (attribute.name === 'href') {
|
if ((token.name === 'a' || token.name === 'link') && attribute.name === 'href') {
|
||||||
|
this.spans.push(Span.createAnchorFromRange(attribute, attribute.valueRange, Color.String, Font.Underline, Cursor.Pointer, Link.of(attribute.value)));
|
||||||
|
} else if (token.name === 'head' && attribute.name === 'profile') {
|
||||||
|
// FIXME: This does not support multiple profiles separated by white space. See
|
||||||
|
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/head#attr-profile (non standard so no link to a specification)
|
||||||
this.spans.push(Span.createAnchorFromRange(attribute, attribute.valueRange, Color.String, Font.Underline, Cursor.Pointer, Link.of(attribute.value)));
|
this.spans.push(Span.createAnchorFromRange(attribute, attribute.valueRange, Color.String, Font.Underline, Cursor.Pointer, Link.of(attribute.value)));
|
||||||
} else {
|
} else {
|
||||||
this.spans.push(Span.createFromRange(attribute, attribute.valueRange, Color.String));
|
this.spans.push(Span.createFromRange(attribute, attribute.valueRange, Color.String));
|
||||||
|
|
Loading…
Reference in a new issue