Skip to content

Commit

Permalink
Merge branch 'em_magedoc-3973' of github.com:magento/devdocs into em_…
Browse files Browse the repository at this point in the history
…magedoc-3973
  • Loading branch information
erikmarr committed Aug 23, 2019
2 parents 52a9b8e + 1f58dd1 commit acd2e02
Show file tree
Hide file tree
Showing 230 changed files with 14,941 additions and 1,477 deletions.
4 changes: 2 additions & 2 deletions .mdlrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
style '_checks/md_style'
ignore_front_matter true
style '_checks/styles/style-rules-dev'
ignore_front_matter true
2 changes: 1 addition & 1 deletion Docfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ content_map:
-
directory: mftf
repository: magento/magento2-functional-testing-framework
branch: develop
branch: master
filter: true
-
directory: page-builder
Expand Down
22 changes: 13 additions & 9 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@ require 'kramdown'
require 'launchy'
require 'colorator'

# Load ruby files with helper methods from the 'rakelib/' directory
require_relative 'rakelib/lib/link-checker.rb'
require_relative 'rakelib/lib/converter.rb'
require_relative 'rakelib/lib/double-slash-check.rb'
require_relative 'rakelib/lib/doc-config.rb'
# Require helper methods from the 'lib' directory
Dir.glob('lib/**/*.rb') { |file| require_relative(file) }

desc "Same as 'rake', 'rake preview'"
task default: %w[preview]
Expand Down Expand Up @@ -61,11 +58,18 @@ end
desc 'Pull docs from external repositories'
task init: %w[multirepo:init]

desc 'Run checks (image optimization).'
task check: %w[check:image_optim check:mdl]
desc 'Run checks (image optimization and Markdown style linting).'
task check: %w[check:image_optim check:mdl]

desc 'Generate data for the weekly digest.'
desc 'Generate data for a news digest. Default timeframe is a week since today. For other period, use "since" argument: since="jul 4"'
task :whatsnew do
date = ENV['since']
print 'Generating data for the weekly digest: $ '.magenta
sh 'whatsup_github'
if date.nil? or date.empty?
sh 'bin/whatsup_github'
elsif date.is_a? String
sh 'bin/whatsup_github', 'since', ENV['since'].to_s
else
puts 'The "since" argument must be a string/ Example: "jul 4"'
end
end
17 changes: 11 additions & 6 deletions _checks/html-check-hook.rb → _checks/html_check_hook.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# The hook runs html-proofer with options defined in the
# _config.checks.yml file
#
Expand All @@ -6,7 +8,7 @@
#
require 'html-proofer'
require 'yaml'
require_relative '../rakelib/lib/double-slash-check.rb'
require_relative '../lib/double_slash_check.rb'

Jekyll::Hooks.register :site, :post_write do |site|
# Do nothing unless 'site.check_links' is set
Expand All @@ -15,17 +17,20 @@
# Do not exit when html-proofer raises an error
begin
# Check 'url_ignore' in '_config.checks.yml'
# and add 'excludes' from Jekyll configurtiuon.
# and add 'excludes' from Jekyll configuration.
#
checks_config = YAML.load_file('_config.checks.yml')
url_ignore = checks_config.dig('html-proofer', :url_ignore)
jekyll_excludes = site.config['exclude']
jekyll_excludes_as_regex = jekyll_excludes.map { |item| Regexp.new Regexp.escape(item) }
jekyll_excludes_as_regex =
jekyll_excludes.map do |item|
Regexp.new Regexp.escape(item)
end

if url_ignore
url_ignore.push(jekyll_excludes_as_regex).flatten!.uniq!
else
checks_config['html-proofer'].merge!({ url_ignore: jekyll_excludes_as_regex })
checks_config['html-proofer'].merge!(url_ignore: jekyll_excludes_as_regex)
end

# Read configuration options for html-proofer
Expand All @@ -36,8 +41,8 @@

# Show the message when html-proofer fails.
# Expected that it fails when it finds broken links.
rescue StandardError => msg
puts msg
rescue StandardError => e
puts e
puts 'Fix the broken links before you push the changes to remote branch.'.blue
end
end
8 changes: 6 additions & 2 deletions _checks/md-check-hook.rb → _checks/md_check_hook.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
# frozen_string_literal: true

# This Jekyll hook runs Markdown linter (https://github.com/markdownlint/markdownlint)
# on .md files that git tracks as 'modified' ('git ls-files -m').
# '_checks/md_style' sets a style (https://github.com/markdownlint/markdownlint/blob/master/docs/creating_styles.md)
# '_checks/styles/style-rules-dev' sets a style (https://github.com/markdownlint/markdownlint/blob/master/docs/creating_styles.md)
# that is a set of rules to be applied when linting (https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md).
# '.mdlrc' sets linting configuration (https://github.com/markdownlint/markdownlint/blob/master/docs/configuration.md).
#
# The plugin runs in serving mode only.
#
Jekyll::Hooks.register :site, :post_write do |site|
next unless site.config['serving']

staged_files = `git ls-files -m`.split("\n")
staged_md_files = staged_files.select { |file| File.extname(file) == '.md' }
next if staged_md_files.empty?

puts 'Checking Markdown syntax...'.blue
staged_md_files_as_a_string = staged_md_files.join(' ')
report = `bin/mdl #{staged_md_files_as_a_string}`
puts report.yellow
puts 'The style is defined in _checks/md_style'.yellow
puts 'The style is defined in _checks/styles/style-rules-dev'.yellow
end
File renamed without changes.
38 changes: 38 additions & 0 deletions _checks/styles/style-rules-prod
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
exclude_rule 'MD001'
exclude_rule 'MD002'
exclude_rule 'MD003'
exclude_rule 'MD004'
exclude_rule 'MD005'
exclude_rule 'MD006'
exclude_rule 'MD007'
exclude_rule 'MD009'
exclude_rule 'MD010'
exclude_rule 'MD011'
exclude_rule 'MD012'
exclude_rule 'MD013'
exclude_rule 'MD014'
exclude_rule 'MD018'
exclude_rule 'MD019'
exclude_rule 'MD020'
exclude_rule 'MD021'
exclude_rule 'MD022'
exclude_rule 'MD023'
exclude_rule 'MD024'
exclude_rule 'MD025'
exclude_rule 'MD026'
exclude_rule 'MD027'
exclude_rule 'MD028'
exclude_rule 'MD029'
exclude_rule 'MD030'
exclude_rule 'MD031'
exclude_rule 'MD032'
exclude_rule 'MD033'
exclude_rule 'MD034'
exclude_rule 'MD035'
exclude_rule 'MD036'
exclude_rule 'MD037'
exclude_rule 'MD038'
exclude_rule 'MD039'
exclude_rule 'MD040'
exclude_rule 'MD041'
exclude_rule 'MD046'
17 changes: 13 additions & 4 deletions _config.checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,35 @@
#
html-proofer:

# Do not check external links.
# Validate HTML
:check_html: true

# Do not check external links.
:disable_external: true

# Report only errors that fall within the 4xx status code range.
:only_4xx: true

# Ignores images with empty alt tags.
:empty_alt_ignore: true

# Sort errors by description in the report
:error_sort: :desc

# Use up to 3 parallel processes to speed up internal file checks.
:parallel:
:in_processes: 3

:cache:
:timeframe: 2w

# Ignore entirely the files which pathname matches a specified pattern
:file_ignore:
- !ruby/regexp /page-builder/
- !ruby/regexp /mrg/
- !ruby/regexp /page-builder/
- !ruby/regexp /guides\/v2\.3\/mrg/

:internal_domains:
- devdocs.magento.com

# Ignore any link that includes a specified pattern
# :url_ignore:
Expand Down
9 changes: 8 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ exclude:
- bin
- node_modules
- vendor
- .git
- .github
- .idea
- Gemfile
- Gemfile.lock
Expand All @@ -222,3 +222,10 @@ exclude:
- rakelib
- README.md
- _plugins
- tmp
- lib
- rakelib
- scripts
- redirects.json
- Docfile.yml

Loading

0 comments on commit acd2e02

Please sign in to comment.