chore(lib): add marked dependency and cleanup

This commit is contained in:
mahula 2026-01-15 18:22:47 +01:00
parent df62f39b8f
commit 6f45c47765
4 changed files with 1171 additions and 1571 deletions

View File

@ -118,6 +118,7 @@
"leaflet": "^1.9.4",
"leaflet.locatecontrol": "^0.79.0",
"maplibre-gl": "^5.16.0",
"marked": "^16.4.2",
"radash": "^12.1.0",
"react-colorful": "^5.6.1",
"react-dropzone": "^14.3.8",
@ -141,5 +142,8 @@
"#types/*": "./src/types/*",
"#src/*": "./src/*",
"#root/*": "./*"
},
"overrides": {
"marked": "^16.3.0"
}
}

View File

@ -0,0 +1,19 @@
/**
* Configure marked.js with emStrongMask hook to prevent underscores
* in hashtags from being interpreted as emphasis delimiters.
*/
import { Marked } from 'marked'
import type { marked } from 'marked'
const HASHTAG_REGEX = /#[a-zA-Z0-9À-ÖØ-öø-ʸ_-]+/g
function emStrongMask(src: string): string {
return src.replace(HASHTAG_REGEX, (match) => match.replace(/_/g, 'a'))
}
export function createConfiguredMarked(): typeof marked {
const instance = new Marked()
instance.use({ hooks: { emStrongMask } })
return instance as unknown as typeof marked
}

2714
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -4,5 +4,8 @@
"workspaces": [
"app",
"lib"
]
],
"overrides": {
"marked": "^16.3.0"
}
}