middleman / middleman-syntax

Code syntax highlighting plugin via Rouge for Middleman
https://middlemanapp.com
MIT License
179 stars 57 forks source link

Syntax highlighting to proxy generated pages #59

Closed olliekav closed 5 months ago

olliekav commented 8 years ago

I'm generating blog pages using the Contentful Middleman gem, within these yaml files I have Markdown content that I pass through a markdown renderer with code blocks

  def markdown(content)
    Tilt['markdown'].new { content }.render(scope=self)
  end

And a typical yaml file including a code block in the body (ignore my single quotes around the code block, I just couldn't get it to render on here otherwise!)


---
:id: 
:title: Wordpress Multisite sub-domains with Pow & Apache
:slug: wordpress-multisite-sub-domains-with-pow-apache
:author:
- :id: 
  :name: Ollie Kavanagh
:body: |-
  I have my local dev environment set up with Pow and I then make Apache listen on Port 81 for any PHP apps I'm doing on `.dev`. I'm currently working on a Wordpress Sub-domain multisite yet I was stumped as the sub-domain alias wasn't working for me locally using the following...

' ```
  <Directory "/Users/olliekav/Sites/">
    AllowOverride All
    Require all granted
  </Directory>

  <VirtualHost 127.0.0.1:81>
    ServerName any.dev
    ServerAlias *.dev
    VirtualDocumentRoot "/Users/olliekav/Sites/%1"
  </VirtualHost>
  ```'

And I generate these files via proxy...

app.data.blog.articles.each do |article|
  proxy "/blog/#{article[1][:slug]}/index.html", "/blog/show.html", locals: { 
    article: article[1]
  }, :ignore => true
end

set :markdown_engine, :redcarpet
set :markdown, smartypants: true, fenced_code_blocks: true

activate :syntax, line_numbers: true

Middleman-syntax has a lot of trouble picking up the code blocks form within these pages generated via proxy. Some blocks won't even format and it never gets line numbers. Any ideas?

bhollis commented 8 years ago

I'm not sure - I have no experience with Contentful Middleman. Does the syntax extension work when you use a proxy but to a normal markdown file that contains code?

olliekav commented 8 years ago

I don't think it's a Contentful problem, I found another post with someone having the same issue with code markdown in a yaml data file and generated content.

https://forum.middlemanapp.com/t/add-syntax-highlighting-to-proxy-generated-pages/1772

I'll try that out though and will let you know results.

On Wednesday, 16 December 2015, Ben Hollis notifications@github.com wrote:

I'm not sure - I have no experience with Contentful Middleman. Does the syntax extension work when you use a proxy but to a normal markdown file that contains code?

— Reply to this email directly or view it on GitHub https://github.com/middleman/middleman-syntax/issues/59#issuecomment-165016143 .

Ollie Kavanagh

http://www.olliekav.com

twitter: @olliekav

bhollis commented 8 years ago

Yeah, the use case of generating content out of yaml files with markdown in them is pretty far from what I'm used to.

-Ben

Sent from my phone

On Dec 15, 2015, at 11:06 PM, Ollie Kavanagh notifications@github.com wrote:

I don't think it's a Contentful problem as I found another post with someone having the same issue with code markdown in a yaml data file and generated content.

https://forum.middlemanapp.com/t/add-syntax-highlighting-to-proxy-generated-pages/1772

I'll try that out though and will let you know results.

On Wednesday, 16 December 2015, Ben Hollis notifications@github.com wrote:

I'm not sure - I have no experience with Contentful Middleman. Does the syntax extension work when you use a proxy but to a normal markdown file that contains code?

― Reply to this email directly or view it on GitHub https://github.com/middleman/middleman-syntax/issues/59#issuecomment-165016143 .

Ollie Kavanagh

http://www.olliekav.com

twitter: @olliekav

― Reply to this email directly or view it on GitHub.

sebastiangraz commented 7 years ago

I'm running into the exact same problem. I'm also using contentful to populate yaml data. At this point I really don't think there is any solution for this problem. I've checked in every corner of Google.

markets commented 6 months ago

@olliekav @sebastiangraz Do you have any update about this thing? I'm a bit late to the party 🙏🏼, but I'd like to help understand the problem and find a solution (if feasible).

markets commented 5 months ago

@olliekav Going to close for now, please don't hesitate to reopen in case you can provide any update, a failing test or a sample app that reproduces the error.