diff --git a/common/customtags.ts b/common/customtags.ts index a6eb52cb..f0faf573 100644 --- a/common/customtags.ts +++ b/common/customtags.ts @@ -1,6 +1,7 @@ import { Tag } from "./deps.ts"; export const CommandLinkTag = Tag.define(); +export const CommandLinkNameTag = Tag.define(); export const WikiLinkTag = Tag.define(); export const WikiLinkPageTag = Tag.define(); export const CodeInfoTag = Tag.define(); diff --git a/common/parser.ts b/common/parser.ts index ffcdf170..ca2a3f73 100644 --- a/common/parser.ts +++ b/common/parser.ts @@ -56,11 +56,8 @@ const commandLinkRegex = /^\{\[([^\]]+)\]\}/; const CommandLink: MarkdownConfig = { defineNodes: [ - { - name: "CommandLink", - style: { "CommandLink/...": ct.CommandLinkTag }, - }, - "CommandLinkName", + { name: "CommandLink", style: { "CommandLink/...": ct.CommandLinkTag } }, + { name: "CommandLinkName", style: ct.CommandLinkNameTag }, { name: "CommandLinkMark", style: t.processingInstruction, @@ -225,6 +222,8 @@ export default function buildMarkdown(mdExtensions: MDExt[]): Language { styleTags({ WikiLink: ct.WikiLinkTag, WikiLinkPage: ct.WikiLinkPageTag, + // CommandLink: ct.CommandLinkTag, + // CommandLinkName: ct.CommandLinkNameTag, Task: ct.TaskTag, TaskMarker: ct.TaskMarkerTag, Comment: ct.CommentTag, diff --git a/plugs/core/navigate.ts b/plugs/core/navigate.ts index 7d945c32..a3632b59 100644 --- a/plugs/core/navigate.ts +++ b/plugs/core/navigate.ts @@ -47,9 +47,7 @@ async function actionClickOrActionEnter( break; } case "CommandLink": { - const command = mdTree - .children![0].text!.substring(2, mdTree.children![0].text!.length - 2) - .trim(); + const command = mdTree.children![1].text!; console.log("Got command link", command); await system.invokeCommand(command); break; diff --git a/web/clean_mode.ts b/web/clean_mode.ts index a36d6537..8d2d7847 100644 --- a/web/clean_mode.ts +++ b/web/clean_mode.ts @@ -257,11 +257,13 @@ class HideHeaderMarkPlugin { const cursorOverlaps = ranges.some(({ from, to }) => checkRangeOverlap([from, to], [line.from, line.to]) ); - if (cursorOverlaps) { + if (cursorOverlaps && type.name === "HeaderMark") { widgets.push( Decoration.line({ class: "sb-header-inside" }).range(from), ); return; + } else if (cursorOverlaps) { + return; } if ( type.name === "HeaderMark" && diff --git a/web/style.ts b/web/style.ts index 8756cbb9..22bde370 100644 --- a/web/style.ts +++ b/web/style.ts @@ -17,6 +17,7 @@ export default function highlightStyles(mdExtension: MDExt[]) { { tag: ct.WikiLinkTag, class: "sb-wiki-link" }, { tag: ct.WikiLinkPageTag, class: "sb-wiki-link-page" }, { tag: ct.CommandLinkTag, class: "sb-command-link" }, + { tag: ct.CommandLinkNameTag, class: "sb-command-link-name" }, { tag: ct.TaskTag, class: "sb-task" }, { tag: ct.TaskMarkerTag, class: "sb-task-marker" }, { tag: ct.CodeInfoTag, class: "sb-code-info" }, diff --git a/web/styles/theme.scss b/web/styles/theme.scss index 8b91ddc6..28e54981 100644 --- a/web/styles/theme.scss +++ b/web/styles/theme.scss @@ -187,7 +187,11 @@ color: #959595; } -.sb-command-link { +.sb-command-link.sb-meta { + color: #959595; +} + +.sb-command-link-name { background-color: #e3dfdf; cursor: pointer; border-top: 1px solid silver;