-
-
Notifications
You must be signed in to change notification settings - Fork 77
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
Cannot get rule to work - need examples - please! #12
Comments
@adrianstrahan did you manage to do this? I'm trying to override the render method of newline.. Any idea of how can I do that? @Benjamin-Dobell |
Sample problem here, an example of how to write actual rules would be great. |
Okay, after what took way too long reverse engineering the library, I managed to get this to work with some custom rules.. Caveat: the tags I was trying to parse out are leaf tags, a node about how I believe Here is a sample rule definition just as an example to read a bold/italic html tag. This worked for me, but who knows if its the 'best' way or not.
And here is how I invoke the
This works, with one caveat -- it produces a warning about the Without the undocumented Now, if the custom rule you are trying to implement wraps nested content, you want to return a tag and then call Hope this helps. |
@adrianstrahan maybe you're just missing return for const untickedCheckbox = {
match: (source, state, lookbehind) => /^\[([\s]+?)\](?!\])/.exec(source),
parse: (capture, recurseParse, state) => ({ content: [] }),
render: (node, output, state, styles) => <Text style={{fontSize: 30}}></Text>
}
// ...
<MarkdownView rules={{ untickedCheckbox }}> // ... |
I'm also having this issue, I can't even get any of the parameters to print in the render function |
Hi,
I am trying to write a new rule to allow '[ ]' sequences to be parsed and replaced with a box character (using FontAwesome).
I have the following in my code:
My parse function doesn't need to do anything since the whole of the matched sequence is replaced with a react-native component.
This is my input markdown:
[ ] This is an empty checkbox
All I get back is:
This is an empty checkbox
How can I get the component to appear?
Any examples on how to add a rule would be most helpful - I've gone through the simple-markdown code but can't get this to work.
In fact, any help would be most appreciated.
The text was updated successfully, but these errors were encountered: