From 3aa9e5d5129a3fdd80cc434ec196c0e46e4d187f Mon Sep 17 00:00:00 2001 From: Jonatan Heyman Date: Fri, 3 Mar 2023 00:56:06 +0100 Subject: [PATCH] Override default highlighting style to remove ugly underline on heading tags --- src/editor/theme/light.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/editor/theme/light.js b/src/editor/theme/light.js index f620d67..a35c8f4 100644 --- a/src/editor/theme/light.js +++ b/src/editor/theme/light.js @@ -1,6 +1,9 @@ import { EditorView } from "@codemirror/view"; +import { HighlightStyle, syntaxHighlighting, defaultHighlightStyle } from '@codemirror/language'; +import { tags } from '@lezer/highlight'; -export const heynoteLight = EditorView.theme({ + +const lightTheme = EditorView.theme({ "&": { backgroundColor: "#fff", }, @@ -37,4 +40,16 @@ export const heynoteLight = EditorView.theme({ }, }) +const highlightStyle = HighlightStyle.define([ + ...defaultHighlightStyle.specs, + // override heading style, in order to remove the ugly underline + { tag: tags.heading, fontWeight: 'bold'}, +]) + +const heynoteLight = [ + lightTheme, + syntaxHighlighting(highlightStyle), +]; + +export { heynoteLight };