Skip to content

added support for ignore_front_matter #143

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

Merged
merged 1 commit into from
Aug 21, 2016

Conversation

GarthDB
Copy link
Contributor

@GarthDB GarthDB commented Jul 28, 2016

I use mdl with Jekyll posts, but most have issues with content in the YAML front matter. This pull request would make it possible to ignore the front matter, but markdownlint would report errors with the correct line numbers even thought it would consider the first line to be line following the front matter.

I do think my code could use some clean up and am looking for some mentoring on this issue.

This pull request would close #130

@DavidAnson
Copy link
Contributor

This is something I have done in the Node version in response to an issue/PR. There are additional tests there that may be useful.

DavidAnson/markdownlint@a467f8b

@GarthDB
Copy link
Contributor Author

GarthDB commented Jul 28, 2016

@DavidAnson Yeah, I appreciate it being in the node version, because of that I have been using node in my jekyll projects to lint, which I shouldn't have to do, but the front matter gets in the way.

@mivok
Copy link
Collaborator

mivok commented Aug 21, 2016

Hi Garth,

Thanks for your contribution. You mentioned the code needing cleanup, so I looked through and made a few changes and have put comments here. Overall it looks fine, and the changes were pretty minor:

  • I moved the offset method in lib/mdl/doc.md to be an attr_reader line for consistency with other attributes. Attr_reader is a shorthand way of saying the same thing as you wrote.
  • I changed the [\s\S] to just be a dot in the regex and enabled multiline mode on the regex with /m at the end. I think this better communicates the intent (to match any character).
  • line_offset is set early on in the main mdl.rb file, and then only used once after that. I got rid of the additional variable assignment and just used doc.offset directly.
  • When loading the config option, it will already be a boolean, and so you don't need to include the ternary operator ? true : false afterwards and can just use Config[:ignore_front_matter] directly.

@GarthDB
Copy link
Contributor Author

GarthDB commented Aug 21, 2016

Excellent, thanks @mivok !

@GarthDB GarthDB deleted the front-matter branch August 22, 2016 15:56
@GarthDB
Copy link
Contributor Author

GarthDB commented Aug 22, 2016

@mivok what's your estimated release looking like - I'd love to move these changes into our code climate workflow.

@mivok
Copy link
Collaborator

mivok commented Aug 22, 2016

I'm aiming for either later today or tomorrow for the next release.

@GarthDB
Copy link
Contributor Author

GarthDB commented Aug 22, 2016

Oh, awesome. I'll keep my eye open and make the appropriate pull requests after!

Thanks again for all the work.

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

Successfully merging this pull request may close these issues.

Bullet list in Markdown Front Matter triggers MD032
3 participants