mirror of
https://github.com/intergalacticalvariable/reader.git
synced 2024-11-16 11:42:32 +08:00
fix: tidyMarkdown
This commit is contained in:
parent
6b6774f43b
commit
59f807cb7c
|
@ -1,9 +1,6 @@
|
|||
export function tidyMarkdown(markdown: string): string {
|
||||
const lines = markdown.split('\n');
|
||||
const processedLines = lines.map((line) => {
|
||||
// Remove leading spaces from each line
|
||||
line = line.replace(/^[ \t]+/, '');
|
||||
|
||||
// Handle complex broken links with text and optional images
|
||||
line = line.replace(/\[\s*([^\]\n!]*?)\s*(?:!\[([^\]]*)\]\((.*?)\))?\s*\]\s*\(\s*([^)\n]+)\s*\)/g, (match, text, alt, imgUrl, linkUrl) => {
|
||||
text = text.replace(/\s+/g, ' ').trim();
|
||||
|
|
Loading…
Reference in New Issue
Block a user