OOKNET                             [ /  search the index  ]  
──────────────────────────────────────────────────────────────────────────────────────
══════════════════════════════════════════════════════════════════════════════════════
OOKNET   [ /  search  ]  
────────────────────────────────────────────────
════════════════════════════════════════════════
 
 
master @ 27 LINES
 
[ HISTORY ]  [ UP ]
 

// Standalone markdown rendering for strings that live outside the
// content collections (repo READMEs). Same shape as the astro
// pipeline: gfm, then rehype-ascii for head rules, code frames, and
// ascii tables. Input goes through toGrid first so foreign text can't
// fail the grid checks the pipeline runs, and rehype-ascii runs
// lenient: a construct that still defeats the grid (a table too wide
// for the frame) degrades to a plain code frame on its own instead of
// failing the whole document.
import { unified } from "unified";
import remarkParse from "remark-parse";
import remarkGfm from "remark-gfm";
import remarkRehype from "remark-rehype";
import rehypeStringify from "rehype-stringify";
import { rehypeAscii } from "./rehype-ascii";
import { toGrid } from "./ascii";

const pipeline = unified()
  .use(remarkParse)
  .use(remarkGfm)
  .use(remarkRehype)
  .use(rehypeAscii, { lenient: true })
  .use(rehypeStringify);

export function renderMarkdown(md: string): string {
  return String(pipeline.processSync(toGrid(md)));
}

// Standalone markdown rendering for strings
 that live outside the
// content collections (repo READMEs). Same 
shape as the astro
// pipeline: gfm, then rehype-ascii for head
 rules, code frames, and
// ascii tables. Input goes through toGrid f
irst so foreign text can't
// fail the grid checks the pipeline runs, a
nd rehype-ascii runs
// lenient: a construct that still defeats t
he grid (a table too wide
// for the frame) degrades to a plain code f
rame on its own instead of
// failing the whole document.
import { unified } from "unified";
import remarkParse from "remark-parse";
import remarkGfm from "remark-gfm";
import remarkRehype from "remark-rehype";
import rehypeStringify from "rehype-stringif
y";
import { rehypeAscii } from "./rehype-ascii"
;
import { toGrid } from "./ascii";

const pipeline = unified()
  .use(remarkParse)
  .use(remarkGfm)
  .use(remarkRehype)
  .use(rehypeAscii, { lenient: true })
  .use(rehypeStringify);

export function renderMarkdown(md: string): 
string {
  return String(pipeline.processSync(toGrid(
md)));
}
 
──────────────────────────────────────────────────────────────────────────────────────
OOKNET
────────────────────────────────────────────────
OOKNET