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

Edit table don't recognize escaped | #933

Closed
andermikael opened this issue Mar 25, 2022 · 6 comments
Closed

Edit table don't recognize escaped | #933

andermikael opened this issue Mar 25, 2022 · 6 comments
Assignees
Labels

Comments

@andermikael
Copy link

andermikael commented Mar 25, 2022

I have a table that has a pipe character | in it's value
If I escape the character with an backslash then it looks OK in the preview.
But if I Edit Table then it takes the escaped pipe as an actual pipe and I get a new column.
I also tried to mark the pipe as code but I got the same result!

My test table

| keyword   | values|
|-----------|-----------------------------------------------|
| time      | C, C\| , #/# |

  • MM 2.4.6.3
  • MarkDig
  • Win 10

// Anders
edit table

@RickStrahl RickStrahl self-assigned this Mar 26, 2022
@RickStrahl RickStrahl added the bug label Mar 26, 2022
@RickStrahl
Copy link
Owner

Yeah this is a definite bug, but at the moment there's no good workaround because the parsing physically parses out the | to mean the separator - there's no context of how the separator is used - ie. escaped or quoted.

The escape scenario can be handled somewhat easily by transforming the string and resetting after parsing, but the use case of code is something that i don't have an idea on how to handle.

Couple of things come to mind:

  • Using Markdigs document parsing to actually parse the table (unsure if that's actually supported)
  • Render the table to HTML then capture the HTML instead

The first would work if Markdig supports peeling out the cells and that would be idea. The latter is problematic because it might render away some of the raw Markdown Markup you can potentially use (ie. bold/italic/code etc.)

Have to give this one some thought.

@RickStrahl
Copy link
Owner

Actually a (ugly) workaround is to HTML escape the value |:

image

@RickStrahl
Copy link
Owner

So after a little experimenting I can make the first escaped scenario work with a relatively simple fix using text replacements:

image

However, the code scenario (the second table in the Markdown editor won't work there. That'll require actual parsing of the markdown inside of the cell to determine context - not sure if I want to go down that path 😄

@andermikael
Copy link
Author

If escape using \ works then that's the preferred way of doing it!
No need for using code or html escape...

@RickStrahl
Copy link
Owner

Well, yes, it's preferred in your use case but it may be a requirement for another use case (like the second example).

The fix for your exact issue will go into the next update. I'll give some more thought to how to address the embedded code scenario.

@RickStrahl
Copy link
Owner

So this has been fixed for 2.4.6.4 for the escaped pipe (ie. \|) scenario.

The code scenario is not handled and will leave that as an uncommon edge case if it comes up again in the future (unlikely).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants