File size: 350 Bytes
676fc08
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
import { marked } from "marked";

export function markdownToDoc(markdown: string): string {
  const html = marked.parse(markdown);
  // Word can open an HTML document saved with a ".doc" extension.
  // This function returns that minimal HTML wrapper.
  return `<!DOCTYPE html><html><head><meta charset="utf-8"></head><body>${html}</body></html>`;
}