Merge pull request #280 from rubenvereecken/markdown-lint

Markdown linting
waldyrious/alt-syntax
Ruben Vereecken 2015-05-17 11:30:40 +02:00
commit b694dd10d5
8 changed files with 52 additions and 2 deletions

3
.gitignore vendored
View File

@ -1,6 +1,9 @@
.DS_Store
.md~
# Local Ruby gems #
.gem/
# JetBrains #
.idea/

3
Gemfile Normal file
View File

@ -0,0 +1,3 @@
source 'https://rubygems.org'
gem 'mdl'

16
Gemfile.lock Normal file
View File

@ -0,0 +1,16 @@
GEM
remote: https://rubygems.org/
specs:
kramdown (1.7.0)
mdl (0.2.1)
kramdown (~> 1.5, >= 1.5.0)
mixlib-cli (~> 1.5, >= 1.5.0)
mixlib-config (~> 2.1, >= 2.1.0)
mixlib-cli (1.5.0)
mixlib-config (2.1.0)
PLATFORMS
ruby
DEPENDENCIES
mdl

View File

@ -1,8 +1,24 @@
all: setup index
index:
@TLDRHOME=`pwd` ./scripts/build_index.rb
@echo "Index rebuilt."
setup:
setup: hooks deps
hooks:
@cp ./scripts/pre-commit .git/hooks
@chmod +x .git/hooks/pre-commit
@echo "Git pre-commit hook installed."
deps:
@bundle
@echo "OK"
lint:
@GEM_PATH=.gem find pages -exec .gem/bin/mdl {} --style ./scripts/markdown-style.rb 1>&2 \;
lint-changed:
@./scripts/lint-changed.sh
.PHONY: index setup hooks deps lint lint-changed

File diff suppressed because one or more lines are too long

6
scripts/lint-changed.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
MD_FILES=`git diff --cached --name-only | tr " " "\n" | egrep ^.*\.md$`
# Execute Markdown lint if any markdown files have been changed and added to git
[[ -z "$MD_FILES" ]] || GEM_PATH=.gem .gem/bin/mdl "$MD_FILES"

View File

@ -0,0 +1,5 @@
# This file contains the markdown rules markdownlint will check for
all
exclude_rule 'MD013' # Lengthy lines (80+ chars)
exclude_rule 'MD038' # Spaces inside code backticks

View File

@ -2,3 +2,4 @@
make index
git add ./pages/index.json
make lint-changed