Skip to content

Commit

Permalink
Put comments on MD_REGEXP
Browse files Browse the repository at this point in the history
  • Loading branch information
Earlopain authored and palkan committed Dec 1, 2023
1 parent 421bf94 commit f94a787
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/rubocop/markdown/preprocess.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ class Preprocess
# Only recognizes backticks-style code blocks.
#
# Try it: https://rubular.com/r/YMqSWiBuh2TKIJ
MD_REGEXP = /^([ \t]*`{3,4})([\w[[:blank:]]+]*)?\n([\s\S]+?)(^[ \t]*\1[[:blank:]]*\n?)|(^.*$)/.freeze
MD_REGEXP = /
^([[:blank:]]*`{3,4}) # Match opening backticks
([\w[[:blank:]]+]*)?\n # Match the code block syntax
([\s\S]+?) # Match everything inside the code block
(^[[:blank:]]*\1[[:blank:]]*\n?) # Match closing backticks
|(^.*$) # If we are not in a codeblock, match the whole line
/x.freeze

MARKER = "<--rubocop/md-->"

Expand Down

0 comments on commit f94a787

Please sign in to comment.