Style parameters

This commit is contained in:
Mayuran Visakan 2023-07-10 23:56:24 +01:00
parent d2cf020709
commit a11d29486a
4 changed files with 57 additions and 41 deletions

82
main.js

File diff suppressed because one or more lines are too long

View file

@ -316,12 +316,14 @@ export function createCodeblockCodeMirrorExtensions(settings: CodeStylerSettings
this.decorations.between(syntaxNode.from, syntaxNode.from, (from: number, to: number, decorationValue: Decoration)=>{
this.decorations = this.decorations.update({filterFrom: from, filterTo: to, filter: (from: number, to: number, value: Decoration)=>false});
});
this.decorations = this.decorations.update({add: [{from: syntaxNode.from, to: syntaxNode.from + endOfParameters, value: Decoration.mark({class: 'code-styler-inline-parameters'})}]});
} else {
let openerDecorated = false;
let decorated = false;
this.decorations.between(syntaxNode.from, syntaxNode.from, (from: number, to: number, decorationValue: Decoration)=>{
openerDecorated = true;
if (!decorationValue.spec?.class)
decorated = true;
});
if (!openerDecorated) {
if (!decorated) {
this.decorations = this.decorations.update({add: [{from: syntaxNode.from, to: syntaxNode.from + endOfParameters, value: Decoration.replace({})}]})
if (parameters?.title || (parameters?.icon && getLanguageIcon(parameters.language,languageIcons)))
this.decorations = this.decorations.update({add: [{from: syntaxNode.from, to: syntaxNode.from, value: Decoration.replace({widget: new OpenerWidget(parameters,languageIcons)})}]});

View file

@ -58,3 +58,6 @@ body.code-styler span.code-styler-inline-opener > span > img.code-styler-inline-
.code-styler span.code-styler-inline-opener span:has( > img.code-styler-inline-icon) {
padding-right: 8px;
}
.code-styler .cm-s-obsidian span.cm-inline-code .code-styler-inline-parameters {
color: var(--code-comment);
}

File diff suppressed because one or more lines are too long