0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-03-29 09:58:11 +00:00

add some comments

This commit is contained in:
Víctor Losada Hernández
2026-03-29 00:20:15 +01:00
parent 2dda9c9804
commit 9d2ff401fd
4 changed files with 6 additions and 19 deletions

View File

@@ -43,6 +43,10 @@ const emojiCompletionList = (context)=>{
return div; return div;
} }
})); }));
//Label is the text in the list, comes with an icon that just
//renders example text "abc", hid that with css because i didn't see other choice
//Apply is the text that is set when the choice is selected
//Info is the tooltip
return { return {
from : word.from + 1, from : word.from + 1,
@@ -61,7 +65,6 @@ export const autocompleteEmoji = autocompletion({
const icon = document.createElement('i'); const icon = document.createElement('i');
icon.className = `emojiPreview ${emojis[e]}`; icon.className = `emojiPreview ${emojis[e]}`;
// append directly to a DocumentFragment to return a single node
const fragment = document.createDocumentFragment(); const fragment = document.createDocumentFragment();
fragment.appendChild(icon); fragment.appendChild(icon);

View File

@@ -1,7 +1,7 @@
import { foldService, codeFolding } from '@codemirror/language'; import { foldService, codeFolding } from '@codemirror/language';
const pageFoldExtension = [ const pageFoldExtension = [
foldService.of((state, lineStart)=>{ foldService.of((state, lineStart)=>{ //tells where to fold
const doc = state.doc; const doc = state.doc;
const matcher = /^(?=\\page(?:break)?(?: *{[^\n{}]*})?$)/m; const matcher = /^(?=\\page(?:break)?(?: *{[^\n{}]*})?$)/m;

View File

@@ -253,7 +253,7 @@ export function tokenizeCustomCSS(text) {
return tokens; return tokens;
} }
//assign classes to tags provided by lezer, not unlike the function above
export const customHighlightStyle = HighlightStyle.define([ export const customHighlightStyle = HighlightStyle.define([
{ tag: tags.heading, class: 'cm-header' }, { tag: tags.heading, class: 'cm-header' },
{ tag: tags.heading1, class: 'cm-header cm-header-1' }, { tag: tags.heading1, class: 'cm-header cm-header-1' },
@@ -285,17 +285,6 @@ export const customHighlightStyle = HighlightStyle.define([
{ tag: tags.variableName, class: 'cm-variable' }, { tag: tags.variableName, class: 'cm-variable' },
{ tag: tags.invalid, class: 'cm-error' }, { tag: tags.invalid, class: 'cm-error' },
{ tag: tags.comment, class: 'cm-comment' }, { tag: tags.comment, class: 'cm-comment' },
//custom tags
{ tag: customTags.pageLine, color: '#f0a' },
{ tag: customTags.snippetLine, class: 'cm-snippetLine', color: '#0af' },
{ 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' },
{ tag: customTags.definitionTerm, class: 'cm-dt', fontWeight: 'bold', color: '#0a0' },
{ tag: customTags.definitionDesc, class: 'cm-dd', color: '#070' },
]); ]);

View File

@@ -50,10 +50,5 @@ export const legacyCustomHighlightStyle = HighlightStyle.define([
{ tag: tags.variableName, class: 'cm-variable' }, { tag: tags.variableName, class: 'cm-variable' },
{ tag: tags.invalid, class: 'cm-error' }, { tag: tags.invalid, class: 'cm-error' },
{ tag: tags.comment, class: 'cm-comment' }, { tag: tags.comment, class: 'cm-comment' },
//custom tags
{ tag: customTags.pageLine, color: '#f0a' },
{ tag: customTags.snippetLine, class: 'cm-snippetLine', color: '#0af' },
]); ]);