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

[REF-1308] Markdown not recognising new lines when rendering #1655

Open
samcloudcode opened this issue Aug 22, 2023 · 3 comments
Open

[REF-1308] Markdown not recognising new lines when rendering #1655

samcloudcode opened this issue Aug 22, 2023 · 3 comments
Labels
linear Created by Linear-GitHub Sync

Comments

@samcloudcode
Copy link

samcloudcode commented Aug 22, 2023

Describe the bug
rx.markdown ignores new lines and displays everything on the same line

To Reproduce

import reflex as rx

text = '''
Hello,

This is some text.

Thank you,
'''

class State(rx.State):
    """The app state."""
    pass


def index() -> rx.Component:
    return rx.fragment(
        rx.center(
            rx.markdown(text),
            width='100%',
            height='100vh'
        ),
    )

Expected behavior
New lines in markdown should be displayed as new lines. Instead, they are ignored.

REF-1308

@masenf
Copy link
Collaborator

masenf commented Aug 24, 2023

This appears to be an issue when rendering an rx.markdown component inside of certain flex containers (rx.center,rx.flex, maybe others?).

Wrapping the rx.markdown inside an rx.box results in correct rendering.

Perhaps reflex should always wrap markdown in a box to prevent confusion?

@masenf
Copy link
Collaborator

masenf commented Aug 24, 2023

There are a few issues with reflex markdown:

  1. new lines are not recognised (as per above)

  2. things like tables have no default formatting, and reflex does not have a styleprop for tables so you need to import some css

  3. you cannot change the format of h1, h2, h3 separately, as everything is converted to rx.header with different sizes.

  4. applying styles to a markdown component has no effect, you need to wrap it in a box and then apply styles to the box so the markdown component inherets them

@masenf masenf added the linear Created by Linear-GitHub Sync label Nov 27, 2023
@masenf masenf changed the title Markdown not recognising new lines when rendering [REF-1308] Markdown not recognising new lines when rendering Nov 27, 2023
@masenf masenf added this to the Markdown Usability Improvements milestone Nov 27, 2023
@picklelo picklelo removed this from the Markdown Usability Improvements milestone Feb 23, 2024
@jq6l43d1
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linear Created by Linear-GitHub Sync
Projects
None yet
Development

No branches or pull requests

4 participants