Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 | 1x 1x 1x 1x 1x 116x 114x 114x 2x 2x | export type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
const isInHeadingLevelRange = (level: HeadingLevel) => level >= 1 && level <= 6;
export const heading = (level: HeadingLevel, text: string) => {
if (isInHeadingLevelRange(level)) {
return `${'#'.repeat(level)} ${text}`;
}
throw new Error('level must be between 1 and 6');
};
|