diff --git a/README.md b/README.md index 72fbc4dc..6e7e87c6 100644 --- a/README.md +++ b/README.md @@ -52,13 +52,17 @@ The Front Matter extension tries to make it easy to manage your Markdown pages/c ### Front Matter folding -![](./assets/v2.4.0/folding.png) +

+ Front Matter folding +

### Front Matter highlighting -![](./assets/v2.4.0/fm-highlight.png) +

+ Front Matter highlighting +

-> ** +> **Info**: If you do not want this feature, you can disable it in the extension settings -> `Highlight Front Matter` or by setting the `frontMatter.content.fmHighlight` setting to `false`. ## The panel @@ -71,7 +75,7 @@ To leverage most of the capabilities of the extension. SEO information and every When you open the panel and the current file is not a Markdown file, it will contain the following sections:

- Base view + Base view

> **Info**: both **Global Settings** and **Other Actions** sections are shown for the base view as when a Markdown file is openend. @@ -81,7 +85,7 @@ When you open the Front Matter panel on a Markdown file, you get to see the foll **Global Settings**

- Global settings + Global settings

**SEO Status** @@ -93,7 +97,7 @@ When you open the Front Matter panel on a Markdown file, you get to see the foll **Actions**

- Actions + Actions

**Metadata: Keywords, Tags, Categories** @@ -107,9 +111,11 @@ When you open the Front Matter panel on a Markdown file, you get to see the foll **Other actions**

- Other actions + Other actions

+**Info**: The `Enable write settings` action allow you to make Markdown specific changes to optimize the writing of your articles. It will change settings like the `fontSize`, `lineHeight`, `wordWrap`, `lineNumbers` and more. + ## Custom actions Since version `1.15.0`, the extension allows you to create your own custom actions, by running Node.js scripts from your project. In order to use this functionality, you will need to configure the [`frontMatter.custom.scripts`](#frontmattercustomscripts) setting for your project. @@ -388,6 +394,16 @@ Specify if you want to automatically update the modification date of your markdo } ``` +### `frontMatter.content.fmHighlight` + +Specify if you want to highlight the Front Matter in the Markdown file. Default: `true`. + +```json +{ + "frontMatter.content.fmHighlight": true +} +``` + ## Feedback / issues / ideas Please submit them via creating an issue in the project repository: [issue list](https://github.com/estruyf/vscode-front-matter/issues). diff --git a/assets/v2.4.0/actions.png b/assets/v2.4.0/actions.png new file mode 100644 index 00000000..cb4589df Binary files /dev/null and b/assets/v2.4.0/actions.png differ diff --git a/assets/v2.4.0/baseview.png b/assets/v2.4.0/baseview.png new file mode 100644 index 00000000..b2cc18e6 Binary files /dev/null and b/assets/v2.4.0/baseview.png differ diff --git a/assets/v2.4.0/global-settings.png b/assets/v2.4.0/global-settings.png new file mode 100644 index 00000000..20b4278e Binary files /dev/null and b/assets/v2.4.0/global-settings.png differ diff --git a/assets/v2.4.0/other-actions.png b/assets/v2.4.0/other-actions.png new file mode 100644 index 00000000..61b1de43 Binary files /dev/null and b/assets/v2.4.0/other-actions.png differ diff --git a/src/extension.ts b/src/extension.ts index 2b0af088..f9ca56ad 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -125,11 +125,6 @@ export async function activate({ subscriptions, extensionUri }: vscode.Extension editDebounce = debounceCallback(); subscriptions.push(vscode.workspace.onDidChangeTextDocument(triggerFileChange)); - // Listener for setting changes - subscriptions.push(vscode.workspace.onDidChangeConfiguration(() => { - MarkdownFoldingProvider.triggerHighlighting(); - })); - // Subscribe all commands subscriptions.push( insertTags, diff --git a/src/providers/FrontMatterDecorationProvider.ts b/src/providers/FrontMatterDecorationProvider.ts index 0c15de3b..1b8210ae 100644 --- a/src/providers/FrontMatterDecorationProvider.ts +++ b/src/providers/FrontMatterDecorationProvider.ts @@ -1,6 +1,5 @@ import { TextEditorDecorationType, window, ColorThemeKind } from "vscode"; - export class FrontMatterDecorationProvider { get(): TextEditorDecorationType { diff --git a/src/providers/MarkdownFoldingProvider.ts b/src/providers/MarkdownFoldingProvider.ts index f0056202..0cb625f5 100644 --- a/src/providers/MarkdownFoldingProvider.ts +++ b/src/providers/MarkdownFoldingProvider.ts @@ -44,13 +44,14 @@ export class MarkdownFoldingProvider implements FoldingRangeProvider { public static triggerHighlighting() { const config = workspace.getConfiguration(CONFIG_KEY); const fmHighlight = config.get(SETTINGS_CONTENT_FRONTMATTER_HIGHLIGHT); - const decoration = new FrontMatterDecorationProvider().get(); - if (fmHighlight && MarkdownFoldingProvider.start !== null && MarkdownFoldingProvider.end !== null && MarkdownFoldingProvider.endLine !== null) { + if (MarkdownFoldingProvider.start !== null && MarkdownFoldingProvider.end !== null && MarkdownFoldingProvider.endLine !== null) { const range = new Range(new Position(MarkdownFoldingProvider.start, 0), new Position(MarkdownFoldingProvider.end, MarkdownFoldingProvider.endLine)); - window.activeTextEditor?.setDecorations(decoration, [range]); - } else { - window.activeTextEditor?.setDecorations(decoration, []); + + if (fmHighlight) { + const decoration = new FrontMatterDecorationProvider().get(); + window.activeTextEditor?.setDecorations(decoration, [range]); + } } } } \ No newline at end of file diff --git a/src/webview/ExplorerView.ts b/src/webview/ExplorerView.ts index da669c1a..c96fa299 100644 --- a/src/webview/ExplorerView.ts +++ b/src/webview/ExplorerView.ts @@ -442,6 +442,11 @@ export class ExplorerView implements WebviewViewProvider, Disposable { const config = workspace.getConfiguration(CONFIG_KEY); await config.update(SETTINGS_CONTENT_FRONTMATTER_HIGHLIGHT, autoUpdate); this.getSettings(); + + if (ArticleHelper.isMarkdownFile()) { + // To unset the decorations, we need to reload the whole document/instance + commands.executeCommand(`workbench.action.reloadWindow`); + } } /**