How to use the react-markdown.uriTransformer function in react-markdown

To help you get started, we’ve selected a few react-markdown examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github topheman / npm-registry-browser / src / components / Markdown.js View on Github external
const makeTransformImageUri = ({ repository }) => uri => {
  // make sure to sanitize links through XSS-filter
  let sanitizedUri = uriTransformer(uri);
  // transform github relative links to images to absolute one to raw.githubusercontent.com
  sanitizedUri = repository.isGithub
    ? buildImageUrl(repository, sanitizedUri)
    : sanitizedUri;
  return sanitizedUri;
};
github topheman / npm-registry-browser / src / components / Markdown.js View on Github external
const makeTransformLinkUri = ({ repository }) => uri => {
  // make sure to sanitize links through XSS-filter
  let sanitizedUri = uriTransformer(uri);
  // transform github relative links to absolute ones
  // keep the anchors - will be rendered by LinkRenderer
  sanitizedUri =
    repository.isGithub && !(uri && uri.startsWith("#"))
      ? buildLinkUrl(repository, sanitizedUri)
      : sanitizedUri;
  // transform links to npm to be used by our front router
  return sanitizedUri
    ? sanitizedUri.replace(
        /http[s]?:\/\/(www\.)?npmjs.com\/package\//,
        "#/package/"
      )
    : null;
};
github acikkaynak / acikkaynak-website / src / app / pages / learn / guide / view.tsx View on Github external
function transformLinkUri(uri: string): string {
        if (!isAbsolutePath(uri) && props.metadata && props.metadata.path) {
            const basePath = getPathDirname(props.metadata.path);

            return ReactMarkdown.uriTransformer(
                path.join(basePath, uri),
            );
        }

        return ReactMarkdown.uriTransformer(uri);
    }
github decred / decrediton / app / components / shared / Documentation.js View on Github external
const renderDocLink = ({ href, children }) => {
  const uri = uriTransformer(href);
  return <a> shell.openExternal(uri)} href="#"&gt;{children}</a>;
};
github acikkaynak / acikkaynak-website / src / app / pages / learn / guide / view.tsx View on Github external
function transformLinkUri(uri: string): string {
        if (!isAbsolutePath(uri) && props.metadata && props.metadata.path) {
            const basePath = getPathDirname(props.metadata.path);

            return ReactMarkdown.uriTransformer(
                path.join(basePath, uri),
            );
        }

        return ReactMarkdown.uriTransformer(uri);
    }

react-markdown

React component to render markdown

MIT
Latest version published 12 months ago

Package Health Score

91 / 100
Full package analysis