-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
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
code_block can not styled. #240
Comments
facing the same issue |
I am also facing the same issue, Not working even after overriding the rules. Also marginTop on code_inline is also not wokring. Can anyone suggest why ?
|
Any update ? |
If you use the My solution below, it works. import SyntaxHighlighter from "react-native-syntax-highlighter";
import { docco } from "react-syntax-highlighter/styles/hljs";
const markdownRules = {
fence: (node, children, parent, styles, inheritedStyles = {}) => {
// we trim new lines off the end of code blocks because the parser sends an extra one.
let { content } = node;
if (
typeof node.content === "string" &&
node.content.charAt(node.content.length - 1) === "\n"
) {
content = node.content.substring(0, node.content.length - 1);
}
return (
<SyntaxHighlighter
language={node.sourceInfo}
style={docco}
highlighter={"hljs"}
>
{content}
</SyntaxHighlighter>
);
},
};
<Markdown
debugPrintTree
rules={markdownRules} |
styling the fence worked for me. thanks 😄 |
Thanks, This is working for me for big codes !
|
Thank you for calling out the "fence" solution! |
can anyone help please
The text was updated successfully, but these errors were encountered: