Skip to content

Commit

Permalink
feat: table of content feature
Browse files Browse the repository at this point in the history
  • Loading branch information
vinay-pr committed Sep 14, 2024
1 parent 6791352 commit 75e80ef
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export * from "./strikethrough";
export * from "./subscript";
export * from "./superscript";
export * from "./table";
export * from "./table-of-content";
export * from "./threads-embed";
export * from "./tiktok-embed";
export * from "./twitter-embed";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { BlockAnnotation } from "@atjson/document";

/**
* A table of content is designed to enhance the usability and navigation of
* our content. This feature provides users with a structured and accessible
* way to navigate through various sections of a story, especially long-form
* articles, improving the overall user experience and engagement. It will
* make it easier for users to find specific sections or information quickly.
* It also encourages readers to explore more content by providing them easy
* access to different parts of our content.
*
* It is a way of displaying tabular or database-like data.
* Table of Content displays data as a list of links that tag to headers that
* exist in the body of a story.
*
*/

export class TableOfContent extends BlockAnnotation<{
/**
* a header slice to hold header text
*/
header: string;
/**
* content slice to hold list of links
*/
content: string;
/**
* A named identifier used to describe toc's initial state
*/
isCollapsible?: boolean;
/**
* A named identifier used to quickly jump to this item
*/
anchorName?: string;
/**
* Layout information, used to indicate mutually
* exclusive layouts, for example sizes, floats, etc.
*/
layout?: string;
}> {
static type = "table-of-content";
static vendorPrefix = "offset";
}
2 changes: 2 additions & 0 deletions packages/@atjson/offset-annotations/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import {
Subscript,
Superscript,
Table,
TableOfContent,
ThreadsEmbed,
TikTokEmbed,
TwitterEmbed,
Expand Down Expand Up @@ -91,6 +92,7 @@ export default class OffsetSource extends Document {
Subscript,
Superscript,
Table,
TableOfContent,
ThreadsEmbed,
TikTokEmbed,
TwitterEmbed,
Expand Down

0 comments on commit 75e80ef

Please sign in to comment.