-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(html): allow generating JSON representation of HTML output (#686)
- Loading branch information
Showing
4 changed files
with
275 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
|
||
import { assert, assertEquals, assertRejects } from "jsr:@std/[email protected]"; | ||
import { doc, generateHtml } from "./mod.ts"; | ||
import { doc, generateHtml, generateHtmlAsJSON } from "./mod.ts"; | ||
|
||
Deno.test({ | ||
name: "doc()", | ||
|
@@ -152,3 +152,30 @@ Deno.test({ | |
assertEquals(Object.keys(files).length, 61); | ||
}, | ||
}); | ||
|
||
Deno.test({ | ||
name: "generateHtmlAsJSON()", | ||
async fn() { | ||
const entries = await doc( | ||
["https://deno.land/[email protected]/fmt/colors.ts"], | ||
); | ||
|
||
const files = await generateHtmlAsJSON({ | ||
["file:///colors.ts"]: Object.values(entries)[0], | ||
}, { | ||
markdownRenderer( | ||
md, | ||
_titleOnly, | ||
_filePath, | ||
_anchorizer, | ||
) { | ||
return md; | ||
}, | ||
markdownStripper(md: string) { | ||
return md; | ||
}, | ||
}); | ||
|
||
assertEquals(Object.keys(files).length, 55); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters