refac
This commit is contained in:
+12
-1
@@ -923,8 +923,19 @@ export const processDetails = (content) => {
|
||||
attributes[attributeMatch[1]] = attributeMatch[2];
|
||||
}
|
||||
|
||||
// New format: result in body content; Old format: result in attribute
|
||||
let resultText = '';
|
||||
if (attributes.result) {
|
||||
content = content.replace(match, unescapeHtml(attributes.result));
|
||||
resultText = unescapeHtml(attributes.result);
|
||||
} else {
|
||||
// Extract body content (strip <summary>...</summary>)
|
||||
const bodyMatch = match.match(/<summary>[\s\S]*?<\/summary>\s*([\s\S]*?)\s*<\/details>/i);
|
||||
if (bodyMatch && bodyMatch[1].trim()) {
|
||||
resultText = unescapeHtml(bodyMatch[1].trim());
|
||||
}
|
||||
}
|
||||
if (resultText) {
|
||||
content = content.replace(match, resultText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ function detailsTokenizer(src: string) {
|
||||
}
|
||||
|
||||
function detailsStart(src: string) {
|
||||
return src.match(/^<details>/) ? 0 : -1;
|
||||
return src.match(/^<details[\s>]/) ? 0 : -1;
|
||||
}
|
||||
|
||||
function detailsRenderer(token: any) {
|
||||
|
||||
Reference in New Issue
Block a user