Skip to content

Unexpected Markdown Rendering Differences in Nested Components #905

@OtokoNoIzumi

Description

@OtokoNoIzumi

Issue Description

I've encountered an unexpected behavior where identical Markdown content renders differently depending on its location within components. The same Markdown text appears differently when rendered directly versus when nested inside a Card component.

Reproduction Steps

  1. Create two identical Markdown components with the same content and style
  2. Render one directly and one inside a Card component
  3. Observe the different rendering results

Code Example

class ThemeStyles:
    LAYOUT = {
        "container": {
            "width": "100%"
        },
        "section_title": {
            "margin-bottom": "-4px",
            "padding": "0",
            "background": "pink"
        },
    }
# Direct rendering - renders as expected
solara.Markdown("## Title", style=ThemeStyles.LAYOUT["section_title"])
with solara.Card(style={'width': '100%', 'border-radius': '12px', 'padding': '0', 'cursor': 'pointer', 'position': 'relative', 'transition': 'all 0.3s ease'}):
    solara.Markdown("## some word"])
# Inside SelectionList component - renders same
@solara.component
def SelectionList(items, ...):
    solara.Markdown(f"## {title}", style=ThemeStyles.LAYOUT["section_title"])

# Inside SelectionList component - renders differently
@solara.component
def SelectionList(items, ...):
    solara.Markdown(f"## {title}", style=ThemeStyles.LAYOUT["section_title"])
    with solara.Card(style={'width': '100%', 'border-radius': '12px', 'padding': '0', 'cursor': 'pointer', 'position': 'relative', 'transition': 'all 0.3s ease'}):
        solara.Markdown("## some word"])

Expected Behavior

those all become the same

Current Behavior

image

Specifications

  • Solara Version: 1.40.0
  • Platform: Windows
  • Affected Python Versions: 3.10.14

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions