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

Markdown text inconsistencies #1984

Open
andrewleader opened this issue Oct 1, 2018 · 2 comments
Open

Markdown text inconsistencies #1984

andrewleader opened this issue Oct 1, 2018 · 2 comments
Assignees
Labels
Area-Inconsistency Bugs around renderer inconsistencies across different platforms Area-Renderers Task

Comments

@andrewleader
Copy link
Contributor

andrewleader commented Oct 1, 2018

There are numerous consistency issues between the JavaScript renderer and other renderers regarding Markdown-based content (like ignoring/preserving spaces, HTML entities, etc)

  • Whitespace preservation
  • HTML entities
  • Newline preservation
  • The fact that web visualizer supports things like headers and other markdown features

Repro payload

Repro payload

{
    "type": "AdaptiveCard",
    "body": [
        {
            "type": "TextBlock",
            "text": "Dogs    <\nCats\n\n# New paragraph"
        }
    ],
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.0"
}

As seen on web Visualizer...

image

As seen with UWP renderer...

image

Ignoring/preserving spaces

The JavaScript renderer doesn't preserve whitespace within TextBlock text. Other renderers, like UWP, do. This is a consistency issue, and also blocks proposals like #1078 working for monospace blocks (since those need whitespace preserved).

However, note that according to Markdown specs it seems like whitespace should be trimmed.

HTML entities

We should have consistent behavior here. Looking at CommonMark's specification of Markdown, HTML entities should be understood and processed by Markdown. Considering we are supporting markdown in our text blocks, we should be doing this?

Newline behavior

According to Markdown specs, a single new line should be trimmed and treated as a single whitespace character (thus not creating a new line). 2 or more new lines should be treated as the start of a new paragraph.

@andrewleader andrewleader added Bug Area-Renderers Platform-JavaScript Bugs or features related to the JavaScript renderer labels Oct 1, 2018
@andrewleader andrewleader changed the title HTML renderer doesn't preserve whitespace in text, while other renderers do Markdown text inconsistencies Oct 1, 2018
@andrewleader andrewleader removed the Platform-JavaScript Bugs or features related to the JavaScript renderer label Oct 1, 2018
@dclaux
Copy link
Member

dclaux commented Oct 1, 2018

This is not a problem with the JS renderer. It's a markdown issue, and is actually by design as far as I can tell. Use   to prevent collapsing of spaces.

@andrewleader
Copy link
Contributor Author

@dclaux yep I'm discovering that, we've got a whole lot of Markdown inconsistencies around text (as I've renamed the issue). JavaScript seems to handle it correctly (via use of the Markdown-It).

Can't use   since when rendered on UWP or other renderers, it renders exactly   (hence the added additional details... there's also inconsistency around new lines, etc... fun fun!).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Inconsistency Bugs around renderer inconsistencies across different platforms Area-Renderers Task
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants