middleman-syntax icon indicating copy to clipboard operation
middleman-syntax copied to clipboard

Syntax highlighting to proxy generated pages

Open olliekav opened this issue 10 years ago • 5 comments

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?

olliekav avatar Dec 15 '15 22:12 olliekav

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?

bhollis avatar Dec 16 '15 06:12 bhollis

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 [email protected] 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

olliekav avatar Dec 16 '15 07:12 olliekav

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 [email protected] 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 [email protected] 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.

bhollis avatar Dec 16 '15 08:12 bhollis

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.

sebastiangraz avatar Apr 20 '17 22:04 sebastiangraz

@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 avatar Feb 01 '24 17:02 markets

@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.

markets avatar Mar 17 '24 20:03 markets