oliverv/caro / .agents/skills/oma-hwp
oma-hwp
FlaggedConvert Hangul HWP, HWPX, or HWPML documents to Markdown with kordoc. Use for text, table, and image extraction from these formats.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 8.7 KB |
| config/hwp-config.yaml | config | 1.3 KB |
| resources/balanced-tables.ts | script | 1.1 KB |
| resources/bun.lock | other | 1.4 KB |
| resources/execution-protocol.md | markdown | 7.2 KB |
| resources/flatten-tables.ts | script | 3.3 KB |
| resources/package.json | manifest | 252 B |
| resources/troubleshooting.md | markdown | 4.4 KB |
| resources/tsconfig.json | config | 185 B |
| resources/turndown-plugin-gfm.d.ts | script | 444 B |
resources/flatten-tables.ts
View on GitHub#!/usr/bin/env bun
/// <reference path="./turndown-plugin-gfm.d.ts" />
/**
* flatten-tables.ts: post-process kordoc output:
* 1. convert HTML <table> blocks to GFM pipe tables
* 2. strip Private Use Area characters (Hancom font-specific glyphs)
*
* (1) kordoc emits HTML <table> when a table has colspan/rowspan because GFM
* cannot represent merged cells. This script trades merge-cell fidelity
* for a pure-Markdown output.
* (2) HWP references Hancom-font-specific glyphs via Private Use Area code
* points (U+E000-U+F8FF, U+F0000-U+FFFFD, U+100000-U+10FFFD). Without
* the Hancom font these render as blanks or tofu squares; stripping is
* the pragmatic default for AI / plain-MD consumption.
*
* Usage: bun flatten-tables.ts <file.md> [<file.md>...]
* (also runs under node >= 22.6 via type stripping)
*/
import { constants } from "node:fs";
import { access, readFile, writeFile } from "node:fs/promises";
import TurndownService from "turndown";
import { tables } from "turndown-plugin-gfm";
import { replaceBalancedTables } from "./balanced-tables.js";
export { replaceBalancedTables } from "./balanced-tables.js";
const td = new TurndownService({
headingStyle: "atx",
codeBlockStyle: "fenced",
emDelimiter: "*",
bulletListMarker: "-",
});
td.use(tables);
const files = process.argv.slice(2);
if (import.meta.main && files.length === 0) {
console.error("Usage: bun flatten-tables.ts <file.md> [<file.md>...]");
process.exit(1);
}
const PUA = /[\uE000-\uF8FF\u{F0000}-\u{FFFFD}\u{100000}-\u{10FFFD}]/gu;
async function main(): Promise<void> {
for (const path of files) {
try {
await access(path, constants.F_OK);
} catch {
console.error(`[flatten-tables] not found: ${path}`);
process.exitCode = 1;
continue;
}
const src = await readFile(path, "utf8");
let tableCount = 0;
let keptCount = 0;
let out = replaceBalancedTables(src, (match: string) => {
const nestedTableCount = (match.match(/<table\b/gi) ?? []).length;
if (nestedTableCount > 1) {
keptCount += 1;
return match;
}
const converted = td.turndown(match).trim();
// turndown-plugin-gfm only converts tables whose first row is <th>
// (kordoc always emits one); anything else is kept as HTML — do not
// count it as flattened.
if (converted.startsWith("<table")) {
keptCount += 1;
return match;
}
tableCount += 1;
return `\n\n${converted}\n\n`;
});
let puaCount = 0;
out = out.replace(PUA, () => {
puaCount += 1;
return "";
});
if (tableCount === 0 && puaCount === 0) {
const kept = keptCount ? ` (${keptCount} table(s) kept as HTML: no <th> heading row)` : "";
console.log(`[flatten-tables] ${path}: nothing to change${kept}`);
continue;
}
await writeFile(path, out, "utf8");
const parts: string[] = [];
if (tableCount) parts.push(`${tableCount} table(s) flattened`);
if (keptCount) parts.push(`${keptCount} table(s) kept as HTML (no <th> heading row)`);
if (puaCount) parts.push(`${puaCount} PUA char(s) stripped`);
console.log(`[flatten-tables] ${path}: ${parts.join(", ")}`);
}
}
if (import.meta.main) {
main().catch((err: unknown) => {
console.error("[flatten-tables]", err);
process.exit(1);
});
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |