mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-04-29 23:24:55 +02:00
Merge pull request #280 from rubenvereecken/markdown-lint
Markdown linting
This commit is contained in:
commit
b694dd10d5
8 changed files with 52 additions and 2 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,6 +1,9 @@
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.md~
|
.md~
|
||||||
|
|
||||||
|
# Local Ruby gems #
|
||||||
|
.gem/
|
||||||
|
|
||||||
# JetBrains #
|
# JetBrains #
|
||||||
.idea/
|
.idea/
|
||||||
|
|
||||||
|
|
3
Gemfile
Normal file
3
Gemfile
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
|
gem 'mdl'
|
16
Gemfile.lock
Normal file
16
Gemfile.lock
Normal 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
|
18
Makefile
18
Makefile
|
@ -1,8 +1,24 @@
|
||||||
|
all: setup index
|
||||||
|
|
||||||
index:
|
index:
|
||||||
@TLDRHOME=`pwd` ./scripts/build_index.rb
|
@TLDRHOME=`pwd` ./scripts/build_index.rb
|
||||||
@echo "Index rebuilt."
|
@echo "Index rebuilt."
|
||||||
|
|
||||||
setup:
|
setup: hooks deps
|
||||||
|
|
||||||
|
hooks:
|
||||||
@cp ./scripts/pre-commit .git/hooks
|
@cp ./scripts/pre-commit .git/hooks
|
||||||
@chmod +x .git/hooks/pre-commit
|
@chmod +x .git/hooks/pre-commit
|
||||||
@echo "Git pre-commit hook installed."
|
@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
6
scripts/lint-changed.sh
Executable 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"
|
5
scripts/markdown-style.rb
Normal file
5
scripts/markdown-style.rb
Normal 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
|
|
@ -2,3 +2,4 @@
|
||||||
|
|
||||||
make index
|
make index
|
||||||
git add ./pages/index.json
|
git add ./pages/index.json
|
||||||
|
make lint-changed
|
||||||
|
|
Loading…
Add table
Reference in a new issue