Skip to content

Commit

Permalink
- add tests
Browse files Browse the repository at this point in the history
- change rule number
- add alias
  • Loading branch information
jaymzh committed Jun 7, 2018
1 parent 1415dbc commit 7f6482c
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 3 deletions.
6 changes: 4 additions & 2 deletions docs/RULES.md
Original file line number Diff line number Diff line change
Expand Up @@ -1017,11 +1017,13 @@ To fix this, add a header to the top of your file:
Note: The `level` parameter can be used to change the top level (ex: to h2) in
cases where an h1 is added externally.

### MD042
## MD046 - Code block style

Tags: code

Parameters: Style ("fenced", "indented", default "fenced")
Aliases: code-block-style

Parameters: style ("fenced", "indented", default "fenced")

This rule is truggered what a different code block style is used than the
configured one. For example, in the default configuration this triggers:
Expand Down
3 changes: 2 additions & 1 deletion lib/mdl/rules.rb
Original file line number Diff line number Diff line change
Expand Up @@ -651,8 +651,9 @@ def check_blockquote(errors, elements)
end
end

rule 'MD042', 'Code blocks style' do
rule "MD046", "Code block style" do
tags :code
aliases 'code-block-style'
params :style => :fenced
check do |doc|
doc.element_linenumbers(
Expand Down
6 changes: 6 additions & 0 deletions test/rule_tests/code_block.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
This is text.

This is a {MD046}
code block.

And here is more text
1 change: 1 addition & 0 deletions test/rule_tests/code_block_style.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rule 'MD046'
1 change: 1 addition & 0 deletions test/rule_tests/default_test_style.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
all

exclude_rule "MD041"
exclude_rule "MD046"
1 change: 1 addition & 0 deletions test/rule_tests/spaces_after_list_marker_style.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
rule "MD007", :indent => 4
rule "MD030", :ul_multi => 3, :ol_multi => 2
exclude_rule "MD041"
exclude_rule "MD046"

0 comments on commit 7f6482c

Please sign in to comment.