TocEntry

import { TocEntry } from "jsr:@ende/markdown";

interface

interface TocEntry

A heading in the list toc() returns.

Example: Usage

import type { TocEntry } from "@ende/markdown/types";
import { assertEquals } from "@ende/assert";

const entry: TocEntry = { depth: 2, text: "Install", slug: "install" };
assertEquals(`<a href="#${entry.slug}">${entry.text}</a>`, "<a href=\"#install\">Install</a>");

Properties

depth

depth: Heading["depth"]

The heading level, from 1 to 6.

text

text: string

The heading's plain text, as the slugger got it. Escape it for HTML.

slug

slug: string

The heading's Heading.id.

Source