markit 是做什麼的?
將任何內容轉換為 Markdown。
CLI
# 轉換檔案
npx @shiftlabs/markit report.pdf -q
# 轉換網址
npx @shiftlabs/markit https://en.wikipedia.org/wiki/Markdown -q
# GitHub 網址(儲存庫、檔案、Gist、議題、PR)
npx @shiftlabs/markit https://github.com/owner/repo -q
npx @shiftlabs/markit https://github.com/owner/repo/issues/42 -q
npx @shiftlabs/markit https://gist.github.com/user/id -q
# 寫入檔案
npx @shiftlabs/markit document.docx -q -o output.md
# 查看所有選項
npx @shiftlabs/markit --help
# 查看支援的格式
npx @shiftlabs/markit formats
-q 參數會輸出純 Markdown。--json 參數會輸出 { markdown, title }。
SDK
import { Markit } from "@shiftlabs/markit";
const markit = new Markit();
const { markdown } = await markit.convertFile("report.pdf");
const { markdown } = await markit.convertUrl("https://example.com");
const { markdown } = await markit.convert(buffer, { extension: ".docx" });