github / jekyll-commonmark-ghpages

CommonMark generator for Jekyll used by GitHub Pages
MIT License
63 stars 17 forks source link

Add "HARD_WRAP" option #2

Closed inwardmovement closed 6 years ago

inwardmovement commented 6 years ago

Is it possible to add an HARD_WRAP option like in kramdown, to parse markdown file's new lines into html line breaks?

kivikakk commented 6 years ago

You're in luck, it's already an option! If you specify this in _config.yml:

commonmark:
  options: ["HARDBREAKS"]

you should get the desired result. :)

inwardmovement commented 6 years ago

Oh great! I didn't see it in the docs I searched in. When trying to install the commonmark-ghpages gem (I switched back to kramdown before) I have a message telling me to upgrade rubygems, I did so and now I can't run "bundle exec" anymore, can't build Jekyll... so I have to fix this before trying the HARDBREAKS option.

I must recognize I'm a bit sick of the ruby/gems ecosystem (there are often problems of this kind), I'll have to give Hugo a try haha.

inwardmovement commented 6 years ago

I've got a CommonMark: HARDBREAKS is not a valid option error

image

kivikakk commented 6 years ago

Ah, this is a bug in https://github.com/jekyll/jekyll-commonmark which has been fixed … but there's not been a new version released since.

You should be able to pull the new release directly by adding the following to your Gemfile:

gem "jekyll-commonmark", "1.1.0.1", :git => "https://github.com/jekyll/jekyll-commonmark.git"

Once done, update your bundle and this should work.

And yeah, frankly, I'm not a huge fan of the gem ecosystem either.

inwardmovement commented 6 years ago

So after reinstalling/updating all my gems I find myself with a new problem: image This time a gem/bundler problem I think, aaarg... I could spend hours to try to fix this as usual, but I am moving my blog to Hugo, seems more maintainable/consistent with a simple binary, in the long run it would be more profitable. Anyways thanks for your help @kivikakk :)

kivikakk commented 6 years ago

No problems, I'm sorry the issues have been so many!

inwardmovement commented 6 years ago

I don't think I will use Jekyll, but I managed to fix my ruby/gem tools (I'm quite stubborn to fix something that doesn't work even if I switched to something else haha).
Do you know why I have this error?

λ jekyll serve
Configuration file: C:/laragon/www/test/jekyll-test/_config.yml
            Source: C:/laragon/www/test/jekyll-test
       Destination: C:/laragon/www/test/jekyll-test/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
        CommonMark: HARDBREAKS is not a valid option
     Valid options: DEFAULT, VALIDATE_UTF8, SMART, LIBERAL_HTML_TAG, FOOTNOTES
                    done in 0.785 seconds.
  Please add the following to your Gemfile to avoid polling for changes:
    gem 'wdm', '>= 0.1.0' if Gem.win_platform?
 Auto-regeneration: enabled for 'C:/laragon/www/test/jekyll-test'
    Server address: http://127.0.0.1:4000
  Server running... press ctrl-c to stop.

with _congif.yml:

markdown: CommonMarkGhPages
commonmark:
  options: ["SMART", "FOOTNOTES", "HARDBREAKS"]
  extensions: ["strikethrough", "autolink", "table"]
kivikakk commented 6 years ago

Have you tried making the Gemfile adjustment per above? Could you show me the contents of your Gemfile.lock file? This should only be the case with an older version of jekyll-commonmark.

inwardmovement commented 6 years ago

The Gemfile adjustment did it, thanks!