We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello, How to add highlighting to code blocks separately?
The text was updated successfully, but these errors were encountered:
Please use custom renderer
import React, { ReactNode } from "react"; import type { ViewStyle, TextStyle } from "react-native"; import Markdown, { Renderer, RendererInterface } from "react-native-marked"; import SyntaxHighlighter from "react-native-syntax-highlighter"; import { docco } from "react-syntax-highlighter/styles/hljs"; class CustomRenderer extends Renderer implements RendererInterface { constructor() { super(); } code( text: string, language?: string, _containerStyle?: ViewStyle, _textStyle?: TextStyle ): ReactNode { return ( <SyntaxHighlighter key={this.getKey()} language={language} style={docco} highlighter={"prism" || "hljs"} > {text} </SyntaxHighlighter> ); } } const renderer = new CustomRenderer(); const ExampleComponent = () => { return ( <Markdown value={"`Hello world`"} flatListProps={{ initialNumToRender: 8, }} renderer={renderer} /> ); };
Sorry, something went wrong.
No branches or pull requests
Hello, How to add highlighting to code blocks separately?
The text was updated successfully, but these errors were encountered: