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

Errors showing no markdown #274

Closed
Ryan-Current opened this issue Sep 11, 2024 · 4 comments · Fixed by #276
Closed

Errors showing no markdown #274

Ryan-Current opened this issue Sep 11, 2024 · 4 comments · Fixed by #276
Labels
bug Something isn't working

Comments

@Ryan-Current
Copy link

I ran into an issue with this library where no display will be made at all, without an error.

The issue I ran into included opening a code block in one cell of a table and closing it in another. This made the table disappear completely, without any errors.

Here's an example, the changed cell between the tables is the bottom right cell.

@* Shows a table *@
<MudMarkdown Value="@markdownWorking" />

@* Breaks and shows nothing when the code block is closed *@
<MudMarkdown Value="@markdownNotWorking" />


@code {
    private string markdownWorking = 
    "### My Table: \n\n" +
    "| **Column 1** | **Column 2**   | **Column 3**                |\n" + 
    "|--------------|----------------|-----------------------------|\n" +
    "| Row 1, Col 1 | Row 1, Col 2   |                             |\n" + 
    "|              | Row 2, Col 2   | Row 2, Col 3                |\n" + 
    "| Row 3, Col 1 |                | \u0060\u0060\u0060python    |\n" +
    "|              | Row 4, Col 2   | def greet(name):            |\n" + 
    "| Row 5, Col 1 |                |     return name             |\n" +
    "|              |                |                             |";


    private string markdownNotWorking = 
    "### My Table: \n\n" +
    "| **Column 1** | **Column 2**   | **Column 3**                |\n" + 
    "|--------------|----------------|-----------------------------|\n" +
    "| Row 1, Col 1 | Row 1, Col 2   |                             |\n" + 
    "|              | Row 2, Col 2   | Row 2, Col 3                |\n" + 
    "| Row 3, Col 1 |                | \u0060\u0060\u0060python    |\n" +
    "|              | Row 4, Col 2   | def greet(name):            |\n" + 
    "| Row 5, Col 1 |                |     return name             |\n" +
    "|              |                | \u0060\u0060\u0060          |";
    
}

I would prefer to either get an error, or turn off the formatting if an error occurs but still show the original string, rather than a silent fail with no text displayed.

@MihailsKuzmins
Copy link
Member

Makrdown:

### My Table:

| **Column 1** | **Column 2**   | **Column 3**                |
|--------------|----------------|-----------------------------|
| Row 1, Col 1 | Row 1, Col 2   |                             |
|              | Row 2, Col 2   | Row 2, Col 3                |
| Row 3, Col 1 |                | \u0060\u0060\u0060python    |
|              | Row 4, Col 2   | def greet(name):            |
| Row 5, Col 1 |                |     return name             |
|              |                | \u0060\u0060\u0060          |

Expected render output:
image

@MihailsKuzmins MihailsKuzmins added the bug Something isn't working label Sep 13, 2024
@MihailsKuzmins
Copy link
Member

@Ryan-Current
In order to make it work I would advise you to use a @ string as it is shown down below:

    private string markdownNotWorking =
@"
### My Table:

| **Column 1** | **Column 2**   | **Column 3**                |
|--------------|----------------|-----------------------------|
| Row 1, Col 1 | Row 1, Col 2   |                             |
|              | Row 2, Col 2   | Row 2, Col 3                |
| Row 3, Col 1 |                | \u0060\u0060\u0060python    |
|              | Row 4, Col 2   | def greet(name):            |
| Row 5, Col 1 |                |     return name             |
|              |                | \u0060\u0060\u0060          |
";

image

But I understand that you want to be able to see the original markdown if something fails, so after this branch is merged this is what will be rendered:
image

@Ryan-Current
Copy link
Author

@MihailsKuzmins Thank you for looking into this, and so quickly!

Since this is completed, does that mean a release will be created soon?

@MihailsKuzmins
Copy link
Member

@Ryan-Current yes, I'm planning to release a new version (including this fix) as soon as a new MudBlazor version is released (probably v7.9.0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants