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

pre/code tags in feed are loosing the newlinines #196

Closed
fabsenet opened this issue Oct 23, 2017 · 5 comments
Closed

pre/code tags in feed are loosing the newlinines #196

fabsenet opened this issue Oct 23, 2017 · 5 comments
Assignees

Comments

@fabsenet
Copy link

Hi, I searched around, could not find any still open relevant issue for this, so here i go:

I have a page with a feed, the post contains multiline-code with newlines, the feed has still the code tag but all is in one paragraph now without newlines! I am not sure, what is wrong. My blog is not really far off from the jekyll default+minima?

the blog source is at https://github.com/fabsenet/blog_de
the blog runs at https://fabse.net
the feed is at https://fabse.net/feed.xml
A good example is the latest post, search for "isLedOn" (it is contained in this post: rendered / markdown)

I am not sure, maybe I configured something wrong? But all I know is, the end result is wrong.

Can you guys give me a hint?

@pathawks
Copy link
Member

We do minify the feed template, but that shouldn't affect the content that goes inside that template.

file.content = File.read(file_source_path).gsub(MINIFY_REGEX, "")

The template itself uses the strip filter, which should remove leading and trailing whitespace, but should not affect whitespace inside the content.

<content type="html" xml:base="{{ post.url | absolute_url | xml_escape }}">{{ post.content | strip | xml_escape }}</content>

I'm not sure. I suppose the thing to do is to create a failing test and see if we can get to the bottom of what is stripping those spaces.

@pathawks pathawks self-assigned this Oct 23, 2017
@pathawks
Copy link
Member

@fabsenet I don't think this is anything that you have done wrong. Seems like a problem with the plugin.

@pathawks
Copy link
Member

Hmm... we already do have a test for this.

it "preserves linebreaks in preformatted text in posts" do
expect(contents).to match /Line 1\nLine 2\nLine 3/
end

@pathawks
Copy link
Member

The problem is the jekyll-minifier gem. It collapses all whitespace into a single space.

If you disable that plugin, the feed generates as expected.

You should open an issue there about keeping preformatted whitespace. 👍

@fabsenet
Copy link
Author

jekyll-minifier was actually my first bet on the issue, but I disabled it to test it (at least I thought so) but removingit from the _config.yaml is not enough. I learned that now. I had to remove it from the gemfile as well.

at least you are right, removing jekyll-minifier also removes the problem of missing newlines. thanks so far 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants