Introduce Markdown extensions (#1614)

* Introduce markdown extensions

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2021-11-15 17:04:49 +01:00 committed by GitHub
parent e9defd60dc
commit 8a8bacc0aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
148 changed files with 1878 additions and 1128 deletions

View file

@ -13,7 +13,7 @@ export interface CheatsheetLineProps {
}
const HighlightedCode = React.lazy(
() => import('../../../markdown-renderer/replace-components/highlighted-fence/highlighted-code/highlighted-code')
() => import('../../../markdown-renderer/markdown-extension/highlighted-fence/highlighted-code')
)
const DocumentMarkdownRenderer = React.lazy(() => import('../../../markdown-renderer/document-markdown-renderer'))

View file

@ -6,16 +6,16 @@
import type { Editor, Hint, Hints } from 'codemirror'
import { Pos } from 'codemirror'
import { validAlertLevels } from '../../../markdown-renderer/markdown-it-plugins/alert-container'
import type { Hinter } from './index'
import { findWordAtCursor } from './index'
import { alertLevels } from '../../../markdown-renderer/markdown-extension/alert-markdown-extension'
const wordRegExp = /^:::((?:\w|-|\+)*)$/
const spoilerSuggestion: Hint = {
text: ':::spoiler Toggle label\nToggled content\n::: \n',
displayText: 'spoiler'
}
const suggestions = validAlertLevels
const suggestions = alertLevels
.map(
(suggestion: string): Hint => ({
text: ':::' + suggestion + '\n\n::: \n',

View file

@ -5,7 +5,7 @@
*/
import React, { useCallback, useState } from 'react'
import { ImageLightboxModal } from '../../markdown-renderer/replace-components/image/image-lightbox-modal'
import { ImageLightboxModal } from '../../markdown-renderer/markdown-extension/image/image-lightbox-modal'
import type {
ImageClickedMessage,
ImageDetails

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
import type { LineMarkerPosition } from '../../markdown-renderer/types'
import type { LineMarkerPosition } from '../../markdown-renderer/markdown-extension/linemarker/types'
export const findLineMarks = (
lineMarks: LineMarkerPosition[],

View file

@ -8,8 +8,8 @@ import type { TocAst } from 'markdown-it-toc-done-right'
import type { ReactElement } from 'react'
import React, { Fragment } from 'react'
import { ShowIf } from '../../common/show-if/show-if'
import { createJumpToMarkClickEventHandler } from '../../markdown-renderer/replace-components/link-replacer/link-replacer'
import { tocSlugify } from './toc-slugify'
import { JumpAnchor } from '../../markdown-renderer/markdown-extension/link-replacer/jump-anchor'
export const buildReactDomFromTocAst = (
toc: TocAst,
@ -32,9 +32,9 @@ export const buildReactDomFromTocAst = (
const content = (
<Fragment>
<ShowIf condition={toc.l > 0}>
<a href={headlineUrl} title={rawName} onClick={createJumpToMarkClickEventHandler(slug.substr(1))}>
<JumpAnchor href={headlineUrl} title={rawName} jumpTargetId={slug.substr(1)}>
{rawName}
</a>
</JumpAnchor>
</ShowIf>
<ShowIf condition={toc.c.length > 0}>
<ul>