Skip to content
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

Properly handling task list markdown #215

Open
StCyr opened this issue May 15, 2024 · 0 comments
Open

Properly handling task list markdown #215

StCyr opened this issue May 15, 2024 · 0 comments

Comments

@StCyr
Copy link

StCyr commented May 15, 2024

Hi,

Thanks for your component :-)

I'm using it with the markdown-it-task-lists component to show task list items in github style.

However, I've some difficulties to style it properly. As you can see in the screenshot hereunder, your component still renders the task list as a bullet list in addition to the task list rendering I've implemented.

I think the proper way to fix this is probably to update your component so that it doesn't create a bullet list when it's in fact a task list (ie: when the "-" of the bullet list is followed by a " [(\s|x|X)]" regexp); I believe it would be very difficult for me to implement that in my task list rule (All in all my implementation is already a bit hacky). Don't you think so?

24-05-15 14-51-22 7080

Here's the code I use to render the task list items:

		<Markdown
                            rules={{
                                html_inline: (node, children, parent, styles, inheritedStyles = {}) => (
                                    <BouncyCheckbox key={node.key}
                                        disableText={true}
                                        isChecked={node.content.match(/checked=/)}
                                        size={16}
                                        onPress={() => {
                                            const text = parent[0].children[1].content
                                            updateCardDescriptionTaskListItem(text)
                                        }}
                                    />
                                )
                            }}
			    styles={theme.markdown}
                            mergeStyle={true}
                            markdownit={mdParser}
		>
			    {card.description}
		</Markdown>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant