gma / nesta

File Based CMS and Static Site Generator
http://nestacms.com
MIT License
902 stars 121 forks source link

move rdiscount and RedCloth into template Gemfile #132

Closed nathany closed 11 years ago

nathany commented 11 years ago

It seems a bit wasteful to include these as dependencies when they aren't being used. (eg. using redcarpet)

I considered adding them as development dependencies, but all specs passed without doing so.

Fyi, there is a version 2 of rdiscount.

gma commented 11 years ago

Thanks for the patch.

I get 66 test failures, perhaps because I run rake with bundle exec and you don't (and you've still got RedCloth and Rdiscount installed?). Don't worry about adding them back in as a dev dependency though; I'm pretty happy with the deps where they are. Taking them out would also cause upgrade issues in the next release.

Just for future reference, remember to check exactly what's in a pull request; the diff for this one also has a few changes to Gemfile.lock that I suspect you didn't intend to submit.

Cheers.

nathany commented 11 years ago

Hi Graham,

Sorry, I didn't think to use bundle exec. That makes sense.

I noticed the other changes in Gemfile.lock. I presume that these should've been checked in before. For example, when you added Mr. Sparkle 1e91aae0dc99cb1e23ffcfa1be22b290522cbc40 - Gemfile.lock should have been updated, yes?

It took me a fair bit of time to figure out the likes of Tilt.prefer and how to get Nesta to use Redcarpet and CodeRay or Pygments.rb. I was hoping this would be one step towards a better out-of-the-box experience, but I understand that my PR is lacking a strategy for handling changes to the Gemfile for existing users.

Nathan.

gma commented 11 years ago

Yeah, you might be right about the lock file - there was an incident in the last week when I couldn't work out why I wasn't also committing a lock file (and I thought I'd done the necessary to rebuild it), but I've no idea which repo it was on.

Sorry the Tilt stuff was confusing. Just out of interest, had you discovered this article?

http://nestacms.com/docs/creating-content/changing-the-markdown-processor

I think there might be a bit of work to do towards making some of the articles more discoverable, but I'm not sure.

nathany commented 11 years ago

It was a while ago, but that article looks familiar. There was also one on using a Rack middleware for Pygments, but I decided to go with block_code in Redcarpet, initially with CodeRay instead.

How common is Nesta used for code blogs? It might be nice to provide an easy way of configuring Pygments.rb or CodeRay, which could support whichever markup gems are being used. That's really not related to this PR, however.

gma commented 11 years ago

I think it's fairly common that people use it for code blogs. @rwdaigle created a template app that uses Pygments:

http://www.higherorderheroku.com/articles/deploying-nesta-cms-blog-heroku-cedar-pygments-syntax-highlighting/

The last time I looked into all the various options I concluded that a Markdown processor that enabled you to use fenced code blocks to set language (I think that was best done via a data- attribute on the pre/code tags) and a JavaScript highlighter was a nice clean way to go. At the time, I couldn't find a combination of tools that would do that.

I'm currently using highlight.js.

nathany commented 11 years ago

Pygments.rb is working pretty well for me now. It vendors Pygments itself, and works on Heroku no problem (there were some issues in older versions). Not too long ago, I wrote an article on PostgreSQL and wondered if it could highlight psql console interactions. Yup. "There's a Lexer for that."

My preference for Redcarpet is only because GitHub uses it. It's nice to see that rdiscount is still being maintained, and I know some people prefer RedCloth for Textile. I imagine syntax highlighting support would be best served by some sort of plugin? I kinda prefer hooking into the Markdown processor vs. using Rack middleware... not sure why, maybe it just seems like less could go wrong.

Thanks for Nesta, enjoying it so far.

gma commented 11 years ago

Pygments sounds like it's come on. Do you get the ability to override how to style a code block without putting any obtrusive markup in your HTML (i.e. without stuff that you don't want showing up in the Atom feed)?

On Redcarpet, I prefer it myself. I love the configurability. There was a good reason that we went with Rdiscount as the default though, I just forget what it was. I think it got discussed on the mailing list. If not, it'll have been discussed in one of the issues on here.

The plugin for syntax highlighting; it might be the best way to do it - it would depend on what would need doing (technically) to set it up. Plugins can't put markup in templates though, so it might be best handled with some simple docs, depending on how involved it is to setup.

nathany commented 11 years ago

I haven't paid much attention to my Atom feed, so I'm not totally sure. Redcarpet uses the triple-backtick syntax followed by a language. That language can be passed into Pygments.rb or CodeRay... or it could be parsed out if more configuration is desired (eg. line numbers). But are you talking more about the HTML generated? Or having different options for Atom vs. the Website? I'm not sure I follow...

gma commented 11 years ago

Yeah, I'm talking about the HTML generated by the Markdown processor. One of the highlighting tools leaves ::: ruby or ::: bash in your HTML. I'm fairly confident it isn't Redcarpet though.

nathany commented 11 years ago

Weird. Here's some HTML extracted from my site using Pygments. Looks pretty "normal":

<div class="highlight"><pre><span class="kn">package</span> 
<span class="nx">main</span>&#x000A;&#x000A;<span class="kn">import</span> 
<span class="s">&quot;fmt&quot;</span></pre></div>

Except for those newline character entities &#x000A;. I hadn't noticed that before. Guess they are necessary in a PRE block.

gma commented 11 years ago

Okay, cheers. I need to revisit this stuff at some point!

On 19 Feb 2013, at 17:03, Nathan Youngman notifications@github.com wrote:

nathany commented 11 years ago

Thanks! Cheers.

nathany commented 11 years ago

There was a good reason that we went with Rdiscount as the default though, I just forget what it was.

I'm guessing it's because redcarpet didn't exist at the time: https://rubygems.org/gems/rdiscount/versions <- latest 1.6.x is January 25, 2011 https://rubygems.org/gems/redcarpet/versions <- first 1.0.0 release is March 28, 2011

gma commented 11 years ago

No, I wanted to choose it but there was a very good reason not to.

On 27 Feb 2013, at 03:38, Nathan Youngman notifications@github.com wrote:

There was a good reason that we went with Rdiscount as the default though, I just forget what it was.

I'm guessing it's because redcarpet didn't exist at the time: https://rubygems.org/gems/rdiscount/versions <- latest 1.6.x is January 25, 2011 https://rubygems.org/gems/redcarpet/versions <- first 1.0.0 release is March 28, 2011

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

Graham Ashton Founder, Agile Planner https://www.agileplannerapp.com | @agileplanner | @grahamashton