mirror of
https://github.com/mayurankv/Obsidian-Code-Styler.git
synced 2026-07-22 08:10:29 +00:00
Style parameters
This commit is contained in:
parent
d2cf020709
commit
a11d29486a
4 changed files with 57 additions and 41 deletions
82
main.js
82
main.js
File diff suppressed because one or more lines are too long
|
|
@ -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)})}]});
|
||||
|
|
|
|||
|
|
@ -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
Loading…
Reference in a new issue