Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions code/addons/docs/src/preview.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import type { PreparedStory } from 'storybook/internal/types';

import * as tocbot from 'tocbot';

if (!globalThis.__STORYBOOK_UNSAFE_TOCBOT__) {
// Users that load dynamic content need to have a way to refresh the TOC, so we expose the tocbot instance
globalThis.__STORYBOOK_UNSAFE_TOCBOT__ = tocbot.default ?? tocbot;
}

const excludeTags = Object.entries(globalThis.TAGS_OPTIONS ?? {}).reduce(
(acc, entry) => {
const [tag, option] = entry;
Expand Down
1 change: 1 addition & 0 deletions code/addons/docs/src/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ declare var __DOCS_CONTEXT__: any;
declare var PREVIEW_URL: any;
declare var LOGLEVEL: 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'silent' | undefined;
declare var TAGS_OPTIONS: import('storybook/internal/types').TagsOptions;
declare var __STORYBOOK_UNSAFE_TOCBOT__: typeof import('tocbot').default;

declare module '*.md';
declare module '*.md?raw';
Loading