diff --git a/src/components/editor/document-renderer-pane/document-render-pane.tsx b/src/components/editor/document-renderer-pane/document-render-pane.tsx index cbf7638c51..55e89359f1 100644 --- a/src/components/editor/document-renderer-pane/document-render-pane.tsx +++ b/src/components/editor/document-renderer-pane/document-render-pane.tsx @@ -8,7 +8,7 @@ import React, { RefObject, useState } from 'react' import { Dropdown } from 'react-bootstrap' import { useSelector } from 'react-redux' import useResizeObserver from 'use-resize-observer' -import { TocAst } from '../../../external-types/markdown-it-toc-done-right/interface' +import { TocAst } from 'markdown-it-toc-done-right' import { ApplicationState } from '../../../redux' import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon' import { ShowIf } from '../../common/show-if/show-if' diff --git a/src/components/editor/table-of-contents/table-of-contents.tsx b/src/components/editor/table-of-contents/table-of-contents.tsx index 799b32b5ba..7e67e7d5cf 100644 --- a/src/components/editor/table-of-contents/table-of-contents.tsx +++ b/src/components/editor/table-of-contents/table-of-contents.tsx @@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only import React, { Fragment, ReactElement, useMemo } from 'react' import { Trans, useTranslation } from 'react-i18next' -import { TocAst } from '../../../external-types/markdown-it-toc-done-right/interface' +import { TocAst } from 'markdown-it-toc-done-right' import { ShowIf } from '../../common/show-if/show-if' import './table-of-contents.scss' diff --git a/src/components/markdown-renderer/full-markdown-renderer.tsx b/src/components/markdown-renderer/full-markdown-renderer.tsx index 468f36d816..411160cdcf 100644 --- a/src/components/markdown-renderer/full-markdown-renderer.tsx +++ b/src/components/markdown-renderer/full-markdown-renderer.tsx @@ -7,7 +7,7 @@ SPDX-License-Identifier: AGPL-3.0-only import React, { useCallback, useMemo, useRef, useState } from 'react' import { Alert } from 'react-bootstrap' import { Trans } from 'react-i18next' -import { TocAst } from '../../external-types/markdown-it-toc-done-right/interface' +import { TocAst } from 'markdown-it-toc-done-right' import { InternalLink } from '../common/links/internal-link' import { ShowIf } from '../common/show-if/show-if' import { RawYAMLMetadata, YAMLMetaData } from '../editor/yaml-metadata/yaml-metadata' diff --git a/src/components/markdown-renderer/hooks/use-post-toc-ast-on-change.ts b/src/components/markdown-renderer/hooks/use-post-toc-ast-on-change.ts index d1e0d57702..fe8969ecad 100644 --- a/src/components/markdown-renderer/hooks/use-post-toc-ast-on-change.ts +++ b/src/components/markdown-renderer/hooks/use-post-toc-ast-on-change.ts @@ -6,7 +6,7 @@ import equal from 'fast-deep-equal' import { RefObject, useEffect, useRef } from 'react' -import { TocAst } from '../../../external-types/markdown-it-toc-done-right/interface' +import { TocAst } from 'markdown-it-toc-done-right' export const usePostTocAstOnChange = (tocAst: RefObject, onTocChange?: (ast: TocAst) => void): void => { const lastTocAst = useRef() diff --git a/src/components/markdown-renderer/markdown-it-configurator/FullMarkdownItConfigurator.tsx b/src/components/markdown-renderer/markdown-it-configurator/FullMarkdownItConfigurator.tsx index a6debc4a54..2a7fdb2eee 100644 --- a/src/components/markdown-renderer/markdown-it-configurator/FullMarkdownItConfigurator.tsx +++ b/src/components/markdown-renderer/markdown-it-configurator/FullMarkdownItConfigurator.tsx @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only */ import MarkdownIt from 'markdown-it' -import { TocAst } from '../../../external-types/markdown-it-toc-done-right/interface' +import { TocAst } from 'markdown-it-toc-done-right' import { RawYAMLMetadata } from '../../editor/yaml-metadata/yaml-metadata' import { documentToc } from '../markdown-it-plugins/document-toc' import { frontmatterExtract } from '../markdown-it-plugins/frontmatter' diff --git a/src/components/markdown-renderer/markdown-it-plugins/document-toc.ts b/src/components/markdown-renderer/markdown-it-plugins/document-toc.ts index 8042f148fe..12c7ecb06a 100644 --- a/src/components/markdown-renderer/markdown-it-plugins/document-toc.ts +++ b/src/components/markdown-renderer/markdown-it-plugins/document-toc.ts @@ -5,13 +5,12 @@ */ import MarkdownIt from 'markdown-it' -import toc from 'markdown-it-toc-done-right' -import { TocAst } from '../../../external-types/markdown-it-toc-done-right/interface' +import toc, { TocAst } from 'markdown-it-toc-done-right' import { slugify } from '../../editor/table-of-contents/table-of-contents' export type DocumentTocPluginOptions = (ast: TocAst) => void -export const documentToc:MarkdownIt.PluginWithOptions = (markdownIt, onToc) => { +export const documentToc: MarkdownIt.PluginWithOptions = (markdownIt, onToc) => { if (!onToc) { return } diff --git a/src/external-types/markdown-it-toc-done-right/index.d.ts b/src/external-types/markdown-it-toc-done-right/index.d.ts deleted file mode 100644 index a2f3f4612e..0000000000 --- a/src/external-types/markdown-it-toc-done-right/index.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) - * - * SPDX-License-Identifier: AGPL-3.0-only - */ - -declare module 'markdown-it-toc-done-right' { - import MarkdownIt from 'markdown-it/lib' - import { TocOptions } from './interface' - const markdownItTocDoneRight: MarkdownIt.PluginWithOptions - export = markdownItTocDoneRight - } diff --git a/src/external-types/markdown-it-toc-done-right/interface.ts b/src/external-types/markdown-it-toc-done-right/interface.ts deleted file mode 100644 index 6f1b74db14..0000000000 --- a/src/external-types/markdown-it-toc-done-right/interface.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) - * - * SPDX-License-Identifier: AGPL-3.0-only - */ - -export interface TocOptions { - placeholder: string - slugify: (s: string) => string - containerClass: string - containerId: string - listClass: string - itemClass: string - linkClass: string - level: number | number[] - listType: 'ol' | 'ul' - format: (s: string) => string - callback: (tocCode: string, ast: TocAst) => void -} - -export interface TocAst { - l: number - n: string - c: TocAst[] -}