KyleBanks / goggles

🔭 Goggles is a cross-platform GUI for your $GOPATH!
Apache License 2.0
671 stars 18 forks source link

Code blocks presented as regular text without new lines. #35

Closed mewmew closed 7 years ago

mewmew commented 7 years ago

From godoc.org Godoc's view of llir/llvm/ir.Instruction

From goggles: Googles' view of llir/llvm/ir.Instruction

Note the different representations for the list of instructions.

godoc:

*ir.InstAdd
*ir.InstFAdd

goggles:

ir.InstAdd ir.InstFAdd

KyleBanks commented 7 years ago

Interesting, I know the docs for KyleBanks/depth render correctly, must be different formatting. I can take a look at this over the weekend.

mewmew commented 7 years ago

Thanks. As visible from the screenshots, the example is taken from

https://godoc.org/github.com/llir/llvm/ir#Instruction

KyleBanks commented 7 years ago

So it turns out that in order to be considered a valid markdown code block it needs to be prefixed with either a tab or four spaces, but GoDoc seems to allow three spaces like you have. I'm going to relax the rules so it works the same way GoDoc does.

mewmew commented 7 years ago

Before you relax it, could you clarify why the comments are interpreted as having 3 spaces? From what I can tell, they seem to have four spaces between // and *?

//    *ir.InstAdd    (https://godoc.org/github.com/llir/llvm/ir#InstAdd)
KyleBanks commented 7 years ago

Sorry that wasn't very clear, when go tools parse source comments they strip the first space of all lines (not just examples), leaving only three indented spaces in this case, and zero spaces in a normal comment like so:

// comment

Perhaps this is why GoDoc still converts it to a code block in HTML, it's probably doing the same thing I plan to in treating three spaces as four.

mewmew commented 7 years ago

I see, thanks for the explanation. I know a lot of the Go standard lib uses tabs rather than spaces to indicate code blocks.

I would too, only in my editor using tabs (with tab size 3) makes code blocks almost indistinguishable from regular comments, as both //<space> and //<tab> are rendered as //. I.e. the tab is 1 character in length, since the tab size is set to 3.

Without this issue, I would have used tabs for code blocks long ago.

KyleBanks commented 7 years ago

No worries, it's a good find - the fix is in now.

screen shot 2017-03-24 at 6 52 14 pm