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 previewing for code blocks breaks when 1st line is square bracket #1668

Closed
lwsrbrts opened this issue Dec 27, 2015 · 9 comments
Closed
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug markdown Markdown support issues verified Verification succeeded
Milestone

Comments

@lwsrbrts
Copy link

A picture speaks a thousand words. First screenshot, Markdown previewing is incorrect and ordered numbering is subsequently broken also as a result of the first line of the code starting with an open square bracket. When the open square bracket is replaced with another character (a number 1 in the second screenshot), the preview works fine.
markdown preview with square bracket
markdown preview with another char

@bpasero
Copy link
Member

bpasero commented Dec 28, 2015

@lwsrbrts can you attach the markdown?

@bpasero bpasero added bug Issue identified by VS Code Team member as probable bug markdown Markdown support issues labels Dec 28, 2015
@bpasero bpasero added this to the Backlog milestone Dec 28, 2015
@bpasero bpasero self-assigned this Dec 28, 2015
@lwsrbrts
Copy link
Author

Sorry, that would have been the intelligent thing to do in the first place. :)

https://raw.githubusercontent.com/lwsrbrts/PoSHue/master/README.md

@bpasero
Copy link
Member

bpasero commented Dec 28, 2015

Thanks!

@bpasero bpasero added the help wanted Issues identified as good community contribution opportunities label Feb 9, 2016
@golf1052
Copy link
Member

So I did some sleuthing to try and figure out what was going on.
TL;DR this seems to be an issue in marked, not in VSCode.

The results of my tests are here
I tried three different markdown parsers, John Gruber's implementation, GitHub's markup, and marked (v0.3.5 where VSCode is using v0.3.2)

README.md is your original file cut down to the part that was breaking. README-mod.md removes a space your first powershell code block. Tildes represent one whitespace character (space).

~2. Run
~
```powershell
~[HueBridge]::FindHueBridge()
~```
~3.

README-1.md adds the one that you added when you were testing.
.html files are the outputs from each parser. -mod.html indicates that file was generated from README-mod.md and -1.html indicates that file was generated from README-1.md. ref.html files were generated by John Gruber's implementation, github.html files were generated by GitHub's markup, and marked.html files were generated by marked.

None of the 3 parse README.md correctly. Only marked parses README-mod.md correctly. All 3 parse README-1.md correctly. (When I mean parse correctly [HueBridge]::FindHueBridge() appears after 2. Run. Online GitHub parses all 3 files correctly. I also tried CommonMark's implementation since I guess Gruber's implementation isn't really the reference implementation and it also parses all 3 files correctly.

¯_(ツ)_/¯

@octref
Copy link
Contributor

octref commented Apr 21, 2016

@bpasero

marked seems to be dead markedjs/marked#724

Maybe switch to a more well-maintained markdown library like https://markdown-it.github.io/ ?
Otherwise this issue can't be fixed.

@wyntau
Copy link

wyntau commented Apr 21, 2016

@octref subscribe #4668 please

@lwsrbrts
Copy link
Author

I've since updated the linked readme.md so it no longer suffers from the issue but the following link is to the point in the repo where I reported the bug.

https://raw.githubusercontent.com/lwsrbrts/PoSHue/4718c4f933031d8c2c8bcdc2bf0561ebe01e067a/README.md

@bpasero
Copy link
Member

bpasero commented Jun 16, 2016

Even with our new markdown extension I still see issues rendering the bullets:

image

@bpasero bpasero assigned kieferrm and unassigned bpasero Jun 16, 2016
@bpasero bpasero removed the help wanted Issues identified as good community contribution opportunities label Jun 16, 2016
@mjbvz mjbvz self-assigned this Sep 28, 2016
@mjbvz
Copy link
Collaborator

mjbvz commented Sep 28, 2016

Since this issue was originally opened to track the markdown preview problems and those seem resolved, I'm going to close this.

I've gone through the example file and opened issues to track some of the editor colorization problems:

#12946 - No/bad colorization of codeblock immediately after a paragraph.
#12946 - No colorization of numbered list punctuator immediately after a paragraph.
#3746 - Fenced code blocks language highlighting can break out of blocks
#12948 - No colorization of block quote punctuator if the quote is indented

Please let me know if you are still seeing issues with the preview, and feel free to open additional bugs to track colorization problems in the markdown editor.

Thanks.

@mjbvz mjbvz closed this as completed Sep 28, 2016
@ramya-rao-a ramya-rao-a added the verified Verification succeeded label Sep 28, 2016
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug markdown Markdown support issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

8 participants