mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-09 15:05:44 +01:00
rebuild MarkdownLinkRenderer and added real world use cases
This commit is contained in:
@@ -29,7 +29,7 @@ import { binder } from "@scm-manager/ui-extensions";
|
||||
import ErrorBoundary from "./ErrorBoundary";
|
||||
import SyntaxHighlighter from "./SyntaxHighlighter";
|
||||
import MarkdownHeadingRenderer from "./MarkdownHeadingRenderer";
|
||||
import MarkdownLinkRenderer from "./MarkdownLinkRenderer";
|
||||
import { create } from "./MarkdownLinkRenderer";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import Notification from "./Notification";
|
||||
|
||||
@@ -39,6 +39,8 @@ type Props = RouteComponentProps & {
|
||||
renderers?: any;
|
||||
skipHtml?: boolean;
|
||||
enableAnchorHeadings?: boolean;
|
||||
// basePath for markdown links
|
||||
basePath?: string;
|
||||
};
|
||||
|
||||
const xmlMarkupSample = `\`\`\`xml
|
||||
@@ -98,7 +100,7 @@ class MarkdownView extends React.Component<Props> {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { content, renderers, renderContext, enableAnchorHeadings, skipHtml } = this.props;
|
||||
const { content, renderers, renderContext, enableAnchorHeadings, skipHtml, basePath } = this.props;
|
||||
|
||||
const rendererFactory = binder.getExtension("markdown-renderer-factory");
|
||||
let rendererList = renderers;
|
||||
@@ -115,7 +117,9 @@ class MarkdownView extends React.Component<Props> {
|
||||
rendererList.heading = MarkdownHeadingRenderer;
|
||||
}
|
||||
|
||||
rendererList.link = MarkdownLinkRenderer;
|
||||
if (basePath && !rendererList.link) {
|
||||
rendererList.link = create(basePath);
|
||||
}
|
||||
|
||||
if (!rendererList.code) {
|
||||
rendererList.code = SyntaxHighlighter;
|
||||
|
||||
Reference in New Issue
Block a user