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

how can I wrap code blocks #491

Open
lyin-vir opened this issue Apr 28, 2023 · 1 comment
Open

how can I wrap code blocks #491

lyin-vir opened this issue Apr 28, 2023 · 1 comment

Comments

@lyin-vir
Copy link

Hi, I ran into an issue when rendering markdown with long code blocks, the entire jsx would overflow the parent component:
image

If I use the forceInline: true option, I get the desired wrapping effect but lost the code block styling:
image

I also tried overriding the pre tag styles like this:

options={{
    overrides: {
        pre: {
            props: {
                style: {
                    'white-space':
                        'pre-wrap',
                },
            },
        },
    },
}}

But it seems that the override style is not merged with the default style, thus I lost the other unspecified styles for pre, resulting similar behavior as the previous screenshot:
image

I also tried adding overflow: auto on the parent component so that I can at least scroll to the right to see the hidden part. But it's still not ideal because all other text will also overflow instead of wrap to the parent width, which make the content difficult to read:
image

Does anyone have any suggestions? Thanks in advance!

@ebdavison
Copy link

A fix for this would be great as we rely on this for our work code and auto-wrap is critical for lines over, say, 1000 characters.

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

2 participants