(props: CodeProps<T>)
| 11 | } |
| 12 | |
| 13 | export function Code<T>(props: CodeProps<T>) { |
| 14 | let container!: HTMLDivElement |
| 15 | const [local, others] = splitProps(props, ["file", "class", "classList", "annotations"]) |
| 16 | |
| 17 | const file = createMemo( |
| 18 | () => |
| 19 | new File<T>( |
| 20 | { |
| 21 | ...createDefaultOptions<T>("unified"), |
| 22 | ...others, |
| 23 | }, |
| 24 | workerPool, |
| 25 | ), |
| 26 | ) |
| 27 | |
| 28 | createEffect(() => { |
| 29 | container.innerHTML = "" |
| 30 | file().render({ |
| 31 | file: local.file, |
| 32 | lineAnnotations: local.annotations, |
| 33 | containerWrapper: container, |
| 34 | }) |
| 35 | }) |
| 36 | |
| 37 | return ( |
| 38 | <div |
| 39 | data-component="code" |
| 40 | style={styleVariables} |
| 41 | classList={{ |
| 42 | ...(local.classList || {}), |
| 43 | [local.class ?? ""]: !!local.class, |
| 44 | }} |
| 45 | ref={container} |
| 46 | /> |
| 47 | ) |
| 48 | } |
nothing calls this directly
no test coverage detected