docs icon indicating copy to clipboard operation
docs copied to clipboard

Markdown highlighting issue

Open ramdog opened this issue 7 years ago • 6 comments

It looks like the markdown highlighting is not working properly. The worst example I see so far is: https://gobuffalo.io/en/docs/apis (see below for screenshot).

I've been on the docs a bit over the last week or so and I almost certain they were not doing this up until recently. I looked over some recent commits and couldn't tell if any caused this (though I'm not sure how to check when this site got deployed last).

I did run the site locally and was able to reproduce. Interestingly, if you remove the bash portion of the ```bash markdown it looks like it fixes the rendering (but you lose some formatting). I'm assuming this is an issue with a library.

The problem

image

Removing bash fixes it (in a way)

image

ramdog avatar Dec 07 '18 04:12 ramdog

Hi, thanks for the report :+1:

AFAIK, the site gets deployed for every commit to master.

I assume that the relevant change was #405 which fixed another markdown issue we had with newer versions of Buffalo and plush (see #404).

@sio4 and I tried to fix this behavior in https://github.com/gobuffalo/plush/pull/77 but it appears to still be incomplete. I don't think this is a general markdown issue in https://github.com/gobuffalo/github_flavored_markdown as it doesn't seem to have received any significant updates lately.

Looking at the html source code, there is a part that's being escaped (the div-part in your first image):

<pre><code>&lt;/div&gt;
--
  | &lt;div class=&#34;col-md-6 col-sm-12&#34;&gt;
  | &lt;h5&gt;&lt;code&gt;buffalo new coke&lt;/code&gt;&lt;/h5&gt;
  | &lt;div class=&#34;highlight highlight-bash&#34;&gt;&lt;pre&gt;├── Dockerfile
  | </code></pre>

Im not sure why this is happening.

Also (at least on my mobile device) the source code highlighting further down ("Tuned actions/app.go actions/render.go Files") is also odd (having some white background).

The relevant html code:

<div class="highlight highlight-go"><pre>func App() *buffalo.App {</p>
--
  |  
  | <pre><code>if app == nil {

#413 is caused by code tabs not getting handled in the partial, it might have a similar cause.

lukasschlueter avatar Dec 07 '18 09:12 lukasschlueter

OMG! interesting! it seems like we need to dig into the markdown parser!

sio4 avatar Dec 07 '18 12:12 sio4

So this indeed seems to again be related to the partials (but maybe not alone).

If I remove the indentation of the html code in templates/docs/apis/_new.md (https://raw.githubusercontent.com/gobuffalo/gobuffalo/master/templates/docs/apis/_new.md) the bash code is correctly highlighted and formatted.

What happens is that the markdown parser interprets the indentation as code formatting for the html - which conforms to the docs: https://guides.github.com/features/mastering-markdown/ As the indentation is not preceded by an empty line, this should not happen and it does not happen if I copy the code to a markdown file outside of the partials.

I will dive into plush once more and try to figure out why it's getting misinterpreted.

lukasschlueter avatar Dec 08 '18 11:12 lukasschlueter

Same goes for the issue in syntax highlighting further down the page: The markdown parser interprets this as another code block (inside a code block though) and renders it again - this time without highlighting which is why there is the white background.

lukasschlueter avatar Dec 08 '18 11:12 lukasschlueter

The main issue should be fixed with gobuffalo/plush#81

The issue regarding source code highlighting is documented in gobuffalo/plush#82 I don't know why it's happening so I'll create a PR for this repo with a workaround soon.

I didn't dig into #413 yet so I can't really tell if it's related. I guess it's not, though.

lukasschlueter avatar Dec 08 '18 16:12 lukasschlueter

Hi, I try to read something about this issue and I understand that the original problem is mainly with formatting! The formatting is ok right now but the code is completely white on black background! This seems to me another problem I don't know if this is the same or not but I guess that we want some king of code highlight here!

This is what I see poor_highlight This is what maybe we want highlight-github

So, maybe the issue need to be reopened ?

Zikoel avatar Jul 31 '20 14:07 Zikoel