contexted link styling

This commit is contained in:
2023-04-30 14:57:43 +02:00
parent 787b5a4cb8
commit 2ff849219b
5 changed files with 83 additions and 33 deletions

View File

@@ -4,8 +4,6 @@ import { mdToHtml } from '@/utils/markdown'
import { getAllMatches } from '@/utils/helpers'
import shortid from 'shortid'
const contextedPrefix = 'c@'
const baseNotes = reactive<{ [noteId: string]: BaseNote }>({})
export const notes = computed<Note[]>(() => {
@@ -40,10 +38,14 @@ export const getNoteById = (noteId: string) => {
return notes.value.find((note) => note.id === noteId)
}
export const getNoteByTitle = (title: string) => {
return notes.value.find((note) => note.title === title)
}
export const findNotes = (query: string): Note[] => {
const removeMdFromText = (mdText: string): string => {
const div = document.createElement('div')
div.innerHTML = mdToHtml(mdText, contextedPrefix, getNoteById)
div.innerHTML = mdToHtml(mdText)
const textWithoutMd = div.textContent || div.innerText || ''
return textWithoutMd
}