Skip to content

Commit

Permalink
fix: expose MarkdownHeading type from astro
Browse files Browse the repository at this point in the history
  • Loading branch information
natemoo-re committed Jul 23, 2022
1 parent 9ef4480 commit f1a6539
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/docs/src/components/RightSidebar/TableOfContents.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { FunctionalComponent } from 'preact';
import { h, Fragment } from 'preact';
import { useState, useEffect, useRef } from 'preact/hooks';
import { MarkdownHeading } from 'astro';

const TableOfContents: FunctionalComponent<{ headings: any[] }> = ({ headings = [] }) => {
const TableOfContents: FunctionalComponent<{ headings: MarkdownHeading[] }> = ({ headings = [] }) => {
const itemOffsets = useRef([]);
const [activeId, setActiveId] = useState<string>(undefined);

useEffect(() => {
const getItemOffsets = () => {
const titles = document.querySelectorAll('article :is(h1, h2, h3, h4)');
Expand Down
8 changes: 8 additions & 0 deletions packages/astro/src/@types/astro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ import type { AstroConfigSchema } from '../core/config';
import type { ViteConfigWithSSR } from '../core/create-vite';
import type { AstroComponentFactory, Metadata } from '../runtime/server';
export type { SSRManifest } from '../core/app/types';
export type {
MarkdownHeading,
MarkdownMetadata,
MarkdownRenderingResult,
RehypePlugins,
RemarkPlugins,
ShikiConfig,
} from '@astrojs/markdown-remark';

export interface AstroBuiltinProps {
'client:load'?: boolean;
Expand Down

0 comments on commit f1a6539

Please sign in to comment.