mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-23 19:47:03 -04:00
Add custom intro page by fetching markdown content from a file (#697)
Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>
This commit is contained in:
parent
4b2e2a7c93
commit
7f6e0e53a7
31 changed files with 373 additions and 173 deletions
src/components/markdown-renderer
|
@ -71,11 +71,13 @@ export const FullMarkdownRenderer: React.FC<FullMarkdownRendererProps & Addition
|
|||
toc => {
|
||||
tocAst.current = toc
|
||||
},
|
||||
lineMarkers => {
|
||||
currentLineMarkers.current = lineMarkers
|
||||
}
|
||||
onLineMarkerPositionChanged === undefined
|
||||
? undefined
|
||||
: lineMarkers => {
|
||||
currentLineMarkers.current = lineMarkers
|
||||
}
|
||||
)).buildConfiguredMarkdownIt()
|
||||
}, [onFrontmatterChange])
|
||||
}, [onLineMarkerPositionChanged, onFrontmatterChange])
|
||||
|
||||
const clearFrontmatter = useCallback(() => {
|
||||
hasNewYamlError.current = false
|
||||
|
|
|
@ -29,7 +29,7 @@ export class FullMarkdownItConfigurator extends BasicMarkdownItConfigurator {
|
|||
private passYamlErrorState: (error: boolean) => void,
|
||||
private onRawMeta: (rawMeta: RawNoteFrontmatter) => void,
|
||||
private onToc: (toc: TocAst) => void,
|
||||
private onLineMarkers: (lineMarkers: LineMarkers[]) => void
|
||||
private onLineMarkers?: (lineMarkers: LineMarkers[]) => void
|
||||
) {
|
||||
super()
|
||||
}
|
||||
|
@ -58,8 +58,12 @@ export class FullMarkdownItConfigurator extends BasicMarkdownItConfigurator {
|
|||
AsciinemaReplacer.markdownItPlugin,
|
||||
highlightedCode,
|
||||
quoteExtra,
|
||||
(markdownIt) => documentToc(markdownIt, this.onToc),
|
||||
(markdownIt) => lineNumberMarker(markdownIt, (lineMarkers) => this.onLineMarkers(lineMarkers))
|
||||
)
|
||||
(markdownIt) => documentToc(markdownIt, this.onToc))
|
||||
if (this.onLineMarkers) {
|
||||
const callback = this.onLineMarkers
|
||||
this.configurations.push(
|
||||
(markdownIt) => lineNumberMarker(markdownIt, (lineMarkers) => callback(lineMarkers))
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue