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 highlighting issue #412

Closed
ramdog opened this issue Dec 7, 2018 · 6 comments
Closed

Markdown highlighting issue #412

ramdog opened this issue Dec 7, 2018 · 6 comments

Comments

@ramdog
Copy link

ramdog commented Dec 7, 2018

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

@lukasschlueter
Copy link
Contributor

Hi, thanks for the report 👍

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 gobuffalo/plush#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.

@sio4
Copy link
Member

sio4 commented Dec 7, 2018

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

@lukasschlueter
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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.

@Zikoel
Copy link

Zikoel commented Jul 31, 2020

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 ?

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

4 participants