Skip to content

Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.

366 B
Raw Blame
import fs from 'fs/promises'

const regexMarkdownCommon = /[`*_#>|[\]()!~-]/g

function normalizeMarkdown(content: string): string {
  return content.replace(regexMarkdownCommon, ' ')
}

export async function parseMarkdown(filePath: string): Promise<string> {
  const content = await fs.readFile(filePath, { encoding: 'utf8' })
  return normalizeMarkdown(content)
}