Spaces:
Runtime error
Runtime error
Download api/src/utils/scrape/plugins/strikethrough.ts from supernovagateway/Steel: direct link, hf CLI and curl.
- Browser
- Download file 902 Bytes
-
https://huggingface.co/spaces/supernovagateway/Steel/resolve/main/api/src/utils/scrape/plugins/strikethrough.ts
- Command line
-
hf download hf://spaces/supernovagateway/Steel/api/src/utils/scrape/plugins/strikethrough.ts
-
curl -L -o strikethrough.ts https://huggingface.co/spaces/supernovagateway/Steel/resolve/main/api/src/utils/scrape/plugins/strikethrough.ts
902 Bytes
| // Adapted from https://github.com/laurent22/joplin/blob/dev/packages/turndown-plugin-gfm/src/tables.js | |
| import TurndownService from "@joplin/turndown"; | |
| export default function taskListItems(turndownService: TurndownService) { | |
| turndownService.addRule("taskListItems", { | |
| filter: function (node) { | |
| const parent = node.parentNode as HTMLElement; | |
| const grandparent = parent.parentNode as HTMLElement; | |
| return ( | |
| (node as HTMLInputElement).type === "checkbox" && | |
| (parent.nodeName === "LI" || | |
| // Handles the case where the label contains the checkbox. For example, | |
| // <label><input ...> ...label text...</label> | |
| (parent.nodeName === "LABEL" && grandparent && grandparent.nodeName === "LI")) | |
| ); | |
| }, | |
| replacement: function (content, node) { | |
| return ((node as HTMLInputElement).checked ? "[x]" : "[ ]") + " "; | |
| }, | |
| }); | |
| } | |