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 2f1321d804..6daefcbb89 100644 --- a/src/components/editor/document-renderer-pane/document-render-pane.tsx +++ b/src/components/editor/document-renderer-pane/document-render-pane.tsx @@ -2,7 +2,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 f8c006cf83..cb3c2d25d2 100644 --- a/src/components/editor/table-of-contents/table-of-contents.tsx +++ b/src/components/editor/table-of-contents/table-of-contents.tsx @@ -1,6 +1,6 @@ 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 62ee083c7e..4bbd339d4b 100644 --- a/src/components/markdown-renderer/full-markdown-renderer.tsx +++ b/src/components/markdown-renderer/full-markdown-renderer.tsx @@ -1,7 +1,7 @@ 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 2fd4948022..b347d90853 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 @@ -1,6 +1,6 @@ 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 60865ea6be..398599f5ec 100644 --- a/src/components/markdown-renderer/markdown-it-configurator/FullMarkdownItConfigurator.tsx +++ b/src/components/markdown-renderer/markdown-it-configurator/FullMarkdownItConfigurator.tsx @@ -1,5 +1,5 @@ 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 0337faa36e..d39fc3119e 100644 --- a/src/components/markdown-renderer/markdown-it-plugins/document-toc.ts +++ b/src/components/markdown-renderer/markdown-it-plugins/document-toc.ts @@ -1,11 +1,10 @@ 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 8992530430..0000000000 --- a/src/external-types/markdown-it-toc-done-right/index.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -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 6491e116d9..0000000000 --- a/src/external-types/markdown-it-toc-done-right/interface.ts +++ /dev/null @@ -1,19 +0,0 @@ -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[] -}