Add inlayErrorResponse

This commit is contained in:
Kwaroran
2025-01-31 17:38:14 +09:00
parent 8174c6dcde
commit 757a944686
6 changed files with 52 additions and 12 deletions

View File

@@ -255,6 +255,11 @@ async function renderHighlightableMarkdown(data:string) {
}
break
}
case 'risuerror':{
lang = 'error'
shotLang = 'error'
break
}
default:{
lang = 'none'
shotLang = 'none'
@@ -266,6 +271,9 @@ async function renderHighlightableMarkdown(data:string) {
if(lang === 'none'){
rendered = rendered.replace(placeholder, `<pre><code>${md.utils.escapeHtml(code)}</code></pre>`)
}
else if(lang === 'error'){
rendered = rendered.replace(placeholder, `<div class="risu-error"><h1>${language.error}</h1>${md.utils.escapeHtml(code)}</div>`)
}
else{
const highlighted = hljs.highlight(code, {
language: lang,
@@ -285,7 +293,7 @@ async function renderHighlightableMarkdown(data:string) {
}
export const assetRegex = /{{(raw|path|img|image|video|audio|bg|emotion|asset|video-img|source)::(.+?)}}/g
export const assetRegex = /{{(raw|path|img|image|video|audio|bg|emotion|asset|video-img|source)::(.+?)}}/gms
async function parseAdditionalAssets(data:string, char:simpleCharacterArgument|character, mode:'normal'|'back', mode2:'unset'|'pre'|'post' = 'unset'){
const assetWidthString = (DBState.db.assetWidth && DBState.db.assetWidth !== -1 || DBState.db.assetWidth === 0) ? `max-width:${DBState.db.assetWidth}rem;` : ''