Page MenuHomeSealhub

heading.ts
No OneTemporary

heading.ts

import { predicates, ShapeToType } from "@sealcode/ts-predicates";
import { Primitive } from "./primitive";
export const HeadingShape = {
type: predicates.const(<const>"heading"),
content: predicates.string,
level: predicates.number,
id: predicates.maybe(predicates.string),
};
export type HeadingJSON = ShapeToType<typeof HeadingShape>;
export class HeadingPrimitive extends Primitive {
content: string;
level: number;
id: string | null = null;
constructor(json: Record<string, unknown>) {
super();
this.content = json["content"] as string;
this.level = json["level"] as number;
this.id = json["id"] as string | null;
}
to_html(): string {
return /* HTML */ `<h1>${this.content}</h1>`;
}
extract_headings(): HeadingPrimitive[] {
return [this];
}
}

File Metadata

Mime Type
text/x-java
Expires
Tue, Dec 24, 14:05 (14 m, 12 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
557337
Default Alt Text
heading.ts (780 B)

Event Timeline