allejo / jekyll-anchor-headings

A GitHub Pages compatible way of adding anchors to your headings without a plug-in or JavaScript :octocat:
https://pure-liquid.allejo.org/
MIT License
186 stars 31 forks source link

Indent with 2 spaces #4

Closed MartijnCuppens closed 5 years ago

MartijnCuppens commented 5 years ago

Jekyll itself uses 2 spaces to indent files (like you can see in these files: https://github.com/jekyll/jekyll/tree/master/docs/_includes). This PR indents the anchor_headings.html with 2 spaces.

allejo commented 5 years ago

Errr... I'm a tad hesitant to accept a PR changing the indentation solely because "<other project> uses 2 space indentation". Am I missing out on some convention or style guide?

The HTML being rendered by this snippet will keep whatever indentation you already have in your content so that's not a concern. If this PR isn't accepted, this is just a snippet you drag and drop manually into a project, so you can reformat it in your _includes folder to match the rest of your code style.

Also, the lack of a final new line is intentional. It's there so this snippet doesn't add any "unnecessary whitespace" in the rendered HTML; it's a remnant of my other jekyll-toc project.

MartijnCuppens commented 5 years ago

The final new line was added by my IDE, didn't realised that. I just removed that here.

There is not really a styleguide, but there is a .editorconfig where they define that the 2 spaces shoud be used: https://github.com/jekyll/jekyll/blob/master/.editorconfig

I like a bit consistency over code styles and think that if a project is extended with a plugin, the plugin should have the same formatting. But that's just my opinion, if for some reason you prefer the current indention, it's totally fine.