16 lines
509 B
TypeScript
16 lines
509 B
TypeScript
import { GefestElement } from "../element";
|
|
|
|
type HeaderLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
|
|
export class GefestHeader extends GefestElement {
|
|
protected level: HeaderLevel;
|
|
constructor(content : (GefestElement | string)[] | string, level : HeaderLevel = 1) {
|
|
super(content);
|
|
this.level = level;
|
|
}
|
|
|
|
protected wrapHTML (content: string): string {
|
|
const attrString = this.attributesToString();
|
|
return `<h${this.level} ${attrString}>${content}</h${this.level}>`;
|
|
}
|
|
} |