0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-03-27 21:08:13 +00:00

good styling

This commit is contained in:
Víctor Losada Hernández
2026-03-27 13:29:31 +01:00
parent ad9f4773b0
commit 98f73dd57c
3 changed files with 22 additions and 9 deletions

View File

@@ -22,6 +22,7 @@ export function tokenizeCustomMarkdown(text) {
const tokens = [];
const lines = text.split('\n');
console.log(tags);
lines.forEach((lineText, lineNumber)=>{
// --- Page / snippet lines ---
if(/^(?=\\page(?:break)?(?: *{[^\n{}]*})?$)/m.test(lineText)) tokens.push({ line: lineNumber, type: customTags.pageLine });
@@ -230,10 +231,22 @@ export function tokenizeCustomMarkdown(text) {
export const customHighlightStyle = HighlightStyle.define([
{ tag: tags.heading, class: 'cm-header' },
{ tag: tags.heading1, class: 'cm-header cm-header-1' },
{ tag: tags.keyword, color: '#07a' }, // example for your markdown headings
{ tag: tags.heading2, class: 'cm-header cm-header-2' },
{ tag: tags.heading3, class: 'cm-header cm-header-3' },
{ tag: tags.heading4, class: 'cm-header cm-header-4' },
{ tag: tags.heading5, class: 'cm-header cm-header-5' },
{ tag: tags.heading6, class: 'cm-header cm-header-6' },
{ tag: tags.link, class: 'cm-link' },
{ tag: tags.string, class: 'cm-string' },
{ tag: tags.url, class: 'cm-string cm-url' },
{ tag: tags.list, class: 'cm-list' },
{ tag: tags.strong, class: 'cm-strong' },
{ tag: tags.emphasis, class: 'cm-em' },
{ tag: customTags.pageLine, color: '#f0a' },
{ tag: customTags.snippetLine, class: 'cm-snippetLine', color: '#0af' },
{ tag: customTags.inlineBlock, class: 'cm-inline-block', backgroundColor: '#fffae6' },
{ tag: customTags.inlineBlock, class: 'cm-inline-block' },
{ tag: customTags.emoji, class: 'cm-emoji', color: '#fa0' },
{ tag: customTags.superscript, class: 'cm-superscript', verticalAlign: 'super', fontSize: '0.8em' },
{ tag: customTags.subscript, class: 'cm-subscript', verticalAlign: 'sub', fontSize: '0.8em' },

View File

@@ -60,16 +60,16 @@
.cm-block:not(.cm-comment) {
font-weight : bold;
color : purple;
//font-style: italic;
}
.cm-inline-block:not(.cm-comment) {
font-weight : bold;
color : red;
//font-style: italic;
color : red ;
span { color : inherit }
}
.cm-injection:not(.cm-comment) {
font-weight : bold;
color : green;
span { color : inherit }
}
.cm-emoji:not(.cm-comment) {
padding-bottom : 1px;

View File

@@ -62,18 +62,18 @@ export const defaultCM5Theme = EditorView.theme({
".cm-atom": { color: "#219" },
".cm-number": { color: "#164" },
".cm-def": { color: "#00f" },
".cm-variable-2": { color: "#05a" },
".cm-list": { color: "#05a" },
".cm-variable-3, .cm-type": { color: "#085" },
".cm-comment": { color: "#a50" },
".cm-string": { color: "#a11" },
".cm-string-2": { color: "#f50" },
".cm-link": { color: "#00c", textDecoration: "underline" },
".cm-string": { color: "#a11", textDecoration: "none" },
".cm-string-2": { color: "#f50", textDecoration: "none" },
".cm-meta, .cm-qualifier": { color: "#555" },
".cm-builtin": { color: "#30a" },
".cm-bracket": { color: "#997" },
".cm-tag": { color: "#170" },
".cm-attribute": { color: "#00c" },
".cm-hr": { color: "#999" },
".cm-link": { color: "#00c", textDecoration: "underline" },
".cm-negative": { color: "#d44" },
".cm-positive": { color: "#292" },
".cm-error, .cm-invalidchar": { color: "#f00" },