Skip to content

Instantly share code, notes, and snippets.

@agatan
agatan / hatena-mt-to-md.ts
Created July 11, 2021 12:56
はてなブログから export した MT ファイルを Markdown に変換する Deno スクリプト
import * as path from "https://deno.land/std@v0.100.0/path/mod.ts";
const content = await Deno.readTextFile(Deno.args[0]);
const outDir = Deno.args[1] || "output";
await Deno.mkdir(outDir, { recursive: true });
console.log(`Export to ${outDir}`);
const articles = content.split("AUTHOR: agtn").slice(1);
function parseArticle(