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

Unexpected ordered list render result #918

Closed
ArtemisSaber opened this issue Jul 27, 2017 · 6 comments
Closed

Unexpected ordered list render result #918

ArtemisSaber opened this issue Jul 27, 2017 · 6 comments

Comments

@ArtemisSaber
Copy link

I'm using marked as markdown parser for my personal blogging site. I found that when treating ordered list it behaves differently on server-side and client-side

  • How to produce this problem :
    A client-side real-time markdown previewer like this one:
        function preview(){
            document.getElementById('Preview').innerHTML = marked($('textarea').val())
        }

A server-side markdown renderer using default config:
var parsedContent = marked(content)

Use markdown string like the following as input:
1. This is a markdown string \n * to show that something goes wrong

  • What is expected:
    That string should be rendered like the following both on client-side and server side
<ol>
    <li>This is a markdown string</li>
    <li>to show that something goes wrong</li>
</ol>
  • What is actually happening:
    That string would render right result on client-side using Chrome browser version 58
    On server, the render result was incorrect, what the server actually gave was:
<ol>
    <li>This is a markdown string</li>
</ol>
<ul>
    <li>to show that something goes wrong</li>
</ul>
@Jiang-Xuan
Copy link

1. This is a markdown string \n * to show that something goes wrong is incorrect.

try this:

1. This is a markdown string \n 2. to show that something goes wrong

@ArtemisSaber
Copy link
Author

@Jiang-Xuan It is a viable workaround. However what I'm looking for is not workaround. The key point here is that it treat the same string differently on server or on client

@Jiang-Xuan
Copy link

Have a look at https://runkit.com/embed/5byhgmo4b53i.

@Jiang-Xuan
Copy link

Perhaps the space behind the '\n' affects the result.

@ArtemisSaber
Copy link
Author

@Jiang-Xuan Oh great, now we have three kind of output here. My server gave me something strange,now this one is giving out even stranger result

@joshbruce
Copy link
Member

See #982

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

No branches or pull requests

3 participants