优化了样式

main
mula.liu 2025-09-25 11:47:21 +08:00
parent 2dc066a2ce
commit aa45d6ae38
1 changed files with 21 additions and 65 deletions

View File

@ -103,78 +103,33 @@ const MindMap = ({ meetingId, meetingTitle, meeting, formatDateTime }) => {
continue;
}
//
// -
if (line.match(/^#+\s+/)) {
//
//
let cleanTitle = line.replace(/\*\*([^*]+)\*\*/g, '$1'); //
cleanTitle = cleanTitle.replace(/[*_]/g, ''); // markdown
processedLines.push(cleanTitle);
//
let j = i + 1;
while (j < lines.length && lines[j].trim() === '') {
j++;
}
//
if (j < lines.length) {
const nextLine = lines[j].trim();
if (!nextLine.match(/^#+\s+/) && !nextLine.match(/^[-*+]\s+/) && !nextLine.includes('|') && nextLine.length > 0) {
//
const paragraphLines = [];
while (j < lines.length) {
const currentLine = lines[j].trim();
if (currentLine === '') {
j++;
continue;
}
if (currentLine.match(/^#+\s+/) || currentLine.match(/^[-*+]\s+/) || currentLine.includes('|')) {
break;
}
paragraphLines.push(currentLine);
j++;
}
//
if (paragraphLines.length > 0) {
const paragraphText = paragraphLines.join(' ');
//
const boldMatches = paragraphText.match(/\*\*([^*]+)\*\*/g);
if (boldMatches && boldMatches.length > 0) {
//
boldMatches.forEach(match => {
const cleanText = match.replace(/\*\*/g, '').trim();
if (cleanText.length > 0 && cleanText.length < 50) { //
processedLines.push(`- ${cleanText}`);
}
});
} else {
//
const keyPhrases = extractKeyPhrases(paragraphText);
keyPhrases.forEach(phrase => {
if (phrase.length > 0) {
processedLines.push(`- ${phrase}`);
}
});
}
}
i = j - 1; // j will be incremented at the end of the loop
}
}
//
const titleLevel = (line.match(/^#+/) || [''])[0].length;
}
//
else if (line.match(/^[-*+]\s+/)) {
const cleanListItem = line.replace(/\*\*([^*]+)\*\*/g, '$1'); //
processedLines.push(cleanListItem);
// -
else if (line.match(/^\s*([-*+]|\d+\.)\s+/)) {
//
const cleanedLine = line.replace(/\*\*([^*]+)\*\*/g, '$1');
processedLines.push(cleanedLine);
}
//
else if (line.startsWith('>')) {
const content = line.replace(/^>+\s*/, '');
processedLines.push(`- ${content}`);
}
// markmap
else if (line.includes('|')) {
processedLines.push(line);
}
//
// -
else if (line.length > 0 && !line.match(/\*\*总字数:\d+字\*\*/)) {
processedLines.push(`- ${line}`);
processedLines.push(line);
}
i++;
@ -193,14 +148,15 @@ const MindMap = ({ meetingId, meetingTitle, meeting, formatDateTime }) => {
try {
const processedMarkdown = preprocessMarkdownForMindMap(markdown);
console.log('原始markdown内容:', markdown);
console.log('预处理后的markdown:', processedMarkdown);
console.log('=== 思维导图数据调试 ===');
console.log('原始markdown内容:');
console.log(markdown);
console.log('预处理后的markdown:');
console.log(processedMarkdown);
const transformer = new Transformer();
const { root } = transformer.transform(processedMarkdown);
console.log('转换后的思维导图数据:', root);
if (markmapRef.current) {
markmapRef.current.setData(root);
} else {