Skip to content

Commit

Permalink
Merge branch 'main' into ko/localized-links/4
Browse files Browse the repository at this point in the history
  • Loading branch information
hochan222 authored Jul 30, 2023
2 parents c779dd3 + 70011a6 commit d25de65
Show file tree
Hide file tree
Showing 11,926 changed files with 186,237 additions and 168,901 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
7 changes: 7 additions & 0 deletions .autocorrectignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# AutoCorrect Link ignore rules.
# https://github.com/huacnlee/autocorrect
#
# Like `.gitignore`, this file to tell AutoCorrect which files need to check, some need to ignore.
files/
docs/
!files/zh-cn/
4 changes: 4 additions & 0 deletions .autocorrectrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
textRules:
一二三,四五六.七八九: 0
一二三,四五六,七八九,一二三,四五六,七八九: 0
9.9亿: 0
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,4 @@
/.github/ @mdn/core-dev
/* @mdn/core-dev
/*.md @mdn/core-dev @mdn/core-yari-content
/.prettierignore
6 changes: 4 additions & 2 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# For more ideas, see https://github.com/actions/labeler#common-examples

system:
- package.json
- yarn.lock
- .github/**/*
- .husky/**/*
- .vscode/**/*
- .*
- front-matter-config.json

l10n-de:
- files/de/**/*
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/autocorrect-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# This workflow to use AutoCorrect tool for checking the copywriting, correct spaces and punctuations for CJK contents.
#
# For example:
#
# - incorrect: "欢迎阅读MDN文档."
# - correct: "欢迎阅读 MDN 文档。"
#
# - incorrect: "Welcome,this is MDN Web Docs。"
# - correct: "Welcome, to read MDN Web Docs."
#
# More details:
# https://github.com/huacnlee/autocorrect
name: AutoCorrect Lint
on:
pull_request:
branches:
- main

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Get changed files
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
# Use the GitHub API to get the list of changed files
# documenation: https://docs.github.com/rest/commits/commits#compare-two-commits
DIFF_DOCUMENTS=$(gh api repos/{owner}/{repo}/compare/${{ env.BASE_SHA }}...${{ env.HEAD_SHA }} \
--jq '.files | .[] | select(.status|IN("added", "modified", "renamed", "copied", "changed")) | .filename')
# filter out files that are not markdown
DIFF_DOCUMENTS=$(echo "${DIFF_DOCUMENTS}" | egrep -i "^files/zh-cn/" | xargs)
echo "DIFF_DOCUMENTS=${DIFF_DOCUMENTS}" >> $GITHUB_ENV
- name: AutoCorrect changed content
if: ${{ env.DIFF_DOCUMENTS }}
uses: huacnlee/[email protected]
with:
args: ${{ env.DIFF_DOCUMENTS }} --lint --no-diff-bg-color
45 changes: 45 additions & 0 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: reviewdog

on:
- pull_request

jobs:
prettier:
# do not run on forks
if: github.repository == 'mdn/translated-content'
name: prettier
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Get changed files
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
# Use the GitHub API to get the list of changed files
# documenation: https://docs.github.com/rest/commits/commits#compare-two-commits
DIFF_DOCUMENTS=$(gh api repos/{owner}/{repo}/compare/${{ env.BASE_SHA }}...${{ env.HEAD_SHA }} --jq '.files | .[] | select(.status|IN("added", "modified", "renamed", "copied", "changed")) | .filename' | xargs)
echo "DIFF_DOCUMENTS=${DIFF_DOCUMENTS}" >> $GITHUB_ENV
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
cache: yarn

- name: Install all yarn packages
run: yarn --frozen-lockfile
env:
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Perform linting
run: yarn prettier --ignore-unknown --write ${{ env.DIFF_DOCUMENTS }}

- name: Submit suggestion
uses: reviewdog/action-suggester@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tool_name: prettier
118 changes: 64 additions & 54 deletions .markdownlint-cli2.jsonc
Original file line number Diff line number Diff line change
@@ -1,52 +1,53 @@
// This file defines our configuration for Markdownlint. See
// https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md
// for more details on each rule.

{
"config": {
"default": true,
// MD001 - Heading levels should only increment by one level at a time.
// -> Disabled, as some callouts include headings.
"MD001": false,
"MD004": {
// Disabled, as some callouts include headings.
"header-increment": false,
"ul-style": {
"style": "dash"
},
"MD007": {
"ul-indent": {
"indent": 2
},
"MD010": {
"no-hard-tabs": {
"spaces_per_tab": 2
},
"MD013": false,
"MD024": false,
"line-length": false,
"no-duplicate-header": false,
// XXX Replace with the following when ready:
// "MD024": {
// "no-duplicate-header": {
// "allow_different_nesting": true
// },
"MD025": {
"single-title": {
"front_matter_title": "^\\s*title\\s*[:=]"
},
"MD026": false,
"no-trailing-punctuation": false,
// XXX Replace with the following when ready:
// "MD026": {
// "no-trailing-punctuation": {
// "punctuation": ".,;:"
// },
// Consecutive Notes/Callouts currently don't conform with this rule
"MD028": false,
"no-blanks-blockquote": false,
// Force ordered numbering to catch accidental list ending from indenting
"MD029": {
"ol-prefix": {
"style": "ordered"
},
"MD033": {
"no-inline-html": {
"allowed_elements": [
"a",
"abbr",
"annotation",
"base",
"br",
"caption",
"code",
"col",
"colgroup",
"dd",
"details",
"dfn",
"div",
"dl",
"dt",
Expand Down Expand Up @@ -88,6 +89,7 @@
"ol",
"p",
"pre",
"q",
"section",
"semantics",
"strong",
Expand All @@ -103,45 +105,47 @@
"tr",
"ul",
"var",
"dfn", // XXX Still used in some translated content
"ruby", // Used in some Korean documents
"rp", // Used in some Korean documents
"rt", // Used in some Korean documents
"i", // French translations use this for English literal text
"q", // French translations use this for English literal text
"h2", // Not always converted currently because of live samples using English IDs
"h3", // Not always converted currently because of live samples using English IDs
"h6" // Not always converted currently because of live samples using English IDs
"h2", // XXX Not always converted currently because of live samples using English IDs
"h3", // XXX Not always converted currently because of live samples using English IDs
"h6" // XXX Not always converted currently because of live samples using English IDs
]
},
"MD034": false,
// XXX Fixed upstream, enable rule when fixed here
"MD036": false,
"no-bare-urls": false,
// XXX Fixed upstream, remove next line when fixed here
"no-emphasis-as-header": false,
// Produces too many false positives
"MD037": false,
"MD040": false,
"no-space-in-emphasis": false,
"fenced-code-language": false,
// See https://github.com/mdn/content/pull/20026, as macros currently break this
"MD042": false,
// XXX Fixed upstream, enable rule when fixed here
"MD045": false,
"MD046": {
"no-empty-links": false,
// XXX Fixed upstream, remove next line when fixed here
"no-alt-text": false,
"code-block-style": {
"style": "fenced"
},
"MD049": false,
"emphasis-style": false,
// XXX Replace with the following when ready:
// "MD049": {
// "emphasis-style": {
// "style": "underscore"
// },
"MD050": {
"strong-style": {
"style": "asterisk"
},
// MD051 - Link fragments should be valid.
// -> Disabled, as yari generates link fragments by replacing spaces with underscores, not dashes.
"MD051": false,
// Incompatible with brackets in macros like MD042
"MD052": false,
// Disabled, as yari generates link fragments by replacing spaces with underscores, not dashes.
"link-fragments": false,
// XXX Fixed upstream, remove next line when fixed here
"reference-links-images": false,

// https://github.com/OnkarRuikar/markdownlint-rule-search-replace
"search-replace": {
"rules": [
// XXX Many instances still found in translated content
// XXX Need to disable this for zh-cn due to grammatical accuracy
// {
// "name": "curly-double-quotes",
// "message": "Don't use curly double quotes",
Expand All @@ -163,21 +167,21 @@
"replace": " ",
"searchScope": "all"
},
// XXX Many instances still found in translated content
// {
// "name": "m-dash",
// "message": "Don't use '--'. Use m-dash — instead",
// "search": " -- ",
// "replace": " — ",
// "searchScope": "text"
// },
// {
// "name": "relative-link",
// "message": "Internal links should start with '/'",
// "searchPattern": "/([\\(\"])[\\w\\-]+\\/docs/g",
// "replace": "$1/en-US/docs",
// "searchScope": "text"
// },
// XXX zh-cn/zh-tw prefers em-dash instead
{
"name": "m-dash",
"message": "Don't use '--'. Use m-dash — instead",
"search": " -- ",
"replace": " — ",
"searchScope": "text"
},
{
"name": "relative-link",
"message": "Internal links should start with '/'",
"searchPattern": "/([\\(\"])([\\w\\-]+)\\/docs/g",
"replace": "$1/$2/docs",
"searchScope": "text"
},
{
"name": "relative-link-path",
"message": "Don't use relative paths",
Expand Down Expand Up @@ -224,5 +228,11 @@
}
},
"customRules": ["markdownlint-rule-search-replace"],
"ignores": ["node_modules", "**/conflicting/**", "**/orphaned/**", ".github/"]
"ignores": [
"node_modules",
".git",
".github",
"**/conflicting/**",
"**/orphaned/**"
]
}
Loading

0 comments on commit d25de65

Please sign in to comment.