diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md deleted file mode 100644 index 342ccb737f..0000000000 --- a/.github/pull_request_template.md +++ /dev/null @@ -1 +0,0 @@ -Original content: diff --git a/.github/workflows/auto-author-assign.yml b/.github/workflows/auto-author-assign.yml new file mode 100644 index 0000000000..157f0b6e79 --- /dev/null +++ b/.github/workflows/auto-author-assign.yml @@ -0,0 +1,16 @@ +name: Auto Author Assign + +on: + pull_request_target: + types: [opened, reopened] + +permissions: + pull-requests: write + +jobs: + assign-author: + runs-on: ubuntu-latest + steps: + - uses: toshimaru/auto-author-assign@v2.0.1 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/spellcheck.yml b/.github/workflows/spellcheck.yml deleted file mode 100644 index 96de2c7105..0000000000 --- a/.github/workflows/spellcheck.yml +++ /dev/null @@ -1,149 +0,0 @@ -name: spellcheck -on: [pull_request] -jobs: - prepare-translation: - outputs: - translation: ${{ steps.translation-check.outputs.translation }} - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - id: changed-files - run: git diff --diff-filter=d --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} > ./changed_files.txt - - name: Check translation - # Check there is only one translation change - # If there are more than one, the workflow will fail - id: translation-changes - run: | - changed_files=$(cat ./changed_files.txt) - if [ -z "$changed_files" ]; then - echo "No files changed" - else - translation_files=$(echo "$changed_files" | grep -E ".*\.md" || ./pass.sh) - echo "$translation_files" - echo "$translation_files" > ./translation_files.txt - fi - - id: translation-check - run: | - translation_files=$(cat ./translation_files.txt) - if [ -z "$translation_files" ]; then - echo "No translation files changed" - else - if [ $(echo "$translation_files" | wc -l) -gt 1 ]; then - echo "More than one translation file changed" - exit 1 - else - echo "translation=$translation_files" >> $GITHUB_OUTPUT - fi - fi - languagetool: - if: ${{ needs.prepare-translation.outputs.translation != '' }} - name: runner / languagetool - needs: [prepare-translation] - outputs: - has_matches: ${{ steps.check-spelling.outputs.has_matches }} - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Remove code blocks - run: | - file=${{ needs.prepare-translation.outputs.translation }} - sed -i '/```/,/```/d' $file - # Strip all macros - - id: strip-macros - run: | - file=${{ needs.prepare-translation.outputs.translation }} - # Remove all macros with no arguments - sed -i 's/{{[a-zA-Z_-]*}}//' $file - # Replace macros with one argument - sed -i 's/{{[[:alnum:]_-]*(\("[[:alnum:]_-]*"\))}}/\1/g' $file - # Replace macros with two arguments - sed -i 's/{{[[:alnum:]_-]*(\("[[:alnum:]_-]*"\), \("[[:alnum:]_-]*"\))}}/\2/g' $file - # Replace macros with more than two arguments - sed -i 's/{{[[:alnum:]_-]*(\("[[:alnum:]_-]*"\), \("[[:alnum:]_-]*"\), \("[[:alnum:]_-]*"\))}}/\2/g' $file - # Reduce markdown to plain text - - run: sudo apt install pandoc -y - - id: md2txt - name: Convert markdown to plain text - run: | - file=${{ needs.prepare-translation.outputs.translation }} - tmpHtmlFile=$(echo $file | sed 's/\.md/\.html/') - pandoc -f markdown -t html -o $tmpHtmlFile $file - newFileName=$(echo $file | sed 's/\.md/\.txt/') - pandoc -f html -t plain -o $newFileName $tmpHtmlFile - echo "translation=$newFileName" >> $GITHUB_OUTPUT - echo $newFileName - - if: steps.md2txt.outputs.translation == '' - name: Check translation is found - run: echo "No translation file found" && exit 1 - - uses: actions/setup-java@v3 - with: - distribution: "temurin" - java-version: "8" - - name: Download LanguageTool - run: wget -q https://languagetool.org/download/LanguageTool-6.3.zip - - name: Unzip LanguageTool - run: unzip -qq LanguageTool-6.3.zip - - name: Add spelling additions - run: | - cat uk_spelling_additions.txt >> ./LanguageTool-6.3/org/languagetool/resource/uk/hunspell/spelling.txt - cat uk_ignore_additions.txt >> ./LanguageTool-6.3/org/languagetool/resource/uk/hunspell/ignore.txt - - id: disabled-rules - name: Determine disabled rules - run: echo "disabled_rules=$(cat disabled_rules.txt | tr '\n' ',')" >> $GITHUB_OUTPUT - - id: check-spelling - name: Check spelling - run: | - cd LanguageTool-6.3 - java -jar languagetool-commandline.jar -d ${{steps.disabled-rules.outputs.disabled_rules}} -l uk --json ../${{ steps.md2txt.outputs.translation }} > ../result.json - cat ../result.json - matches=$(cat ../result.json | jq '.matches') - # Check if matches equal [] - echo "has_matches=$(if [ "$matches" == "[]" ]; then echo "false"; else echo "true"; fi)" >> $GITHUB_OUTPUT - - name: Upload result.json - uses: actions/upload-artifact@v3 - with: - name: result - path: result.json - - name: Upload text file - uses: actions/upload-artifact@v3 - with: - name: text - path: ${{ steps.md2txt.outputs.translation }} - report-spelling: - if: ${{ needs.languagetool.outputs.has_matches != 'false' }} - name: Report spelling - needs: [prepare-translation, languagetool] - permissions: - contents: read - pull-requests: write - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - uses: actions/download-artifact@v3 - with: - name: result - path: . - - uses: actions/setup-node@v4 - with: - node-version: "16" - - uses: actions/download-artifact@v3 - with: - name: text - path: . - - name: Create mapping - run: node scripts/create-file-mapping.js ./index.txt ${{ needs.prepare-translation.outputs.translation }} > ./mapping.json && cat ./mapping.json - - env: - COMMIT_ID: ${{ github.event.pull_request.head.sha }} - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PR_NUMBER: ${{ github.event.pull_request.number }} - name: Send results - run: node scripts/send-comments.js ${{ needs.prepare-translation.outputs.translation }} - timeout-minutes: 5 - - name: Exit with error - run: echo "Spelling errors found" && cat result.json && exit 1 diff --git a/.github/workflows/translation.yml b/.github/workflows/translation.yml new file mode 100644 index 0000000000..8594793422 --- /dev/null +++ b/.github/workflows/translation.yml @@ -0,0 +1,274 @@ +name: spellcheck +on: [pull_request] +jobs: + prepare: + outputs: + status: ${{ steps.translation-check.outputs.status }} + translation: ${{ steps.translation-check.outputs.translation }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - id: changed-files + run: git diff --diff-filter=d --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} > ./changed_files.txt + - name: Check translation + # Check there is only one translation change + # If there are more than one, the workflow will fail + id: translation-changes + run: | + changed_files=$(cat ./changed_files.txt) + if [ -z "$changed_files" ]; then + echo "No files changed" + else + translation_files=$(echo "$changed_files" | grep -E ".*\.md" || ./pass.sh) + # Filter out files not in "files/uk" folder + translation_files=$(echo "$translation_files" | grep -E "^files/uk/.*\.md" || ./pass.sh) + echo "$translation_files" + echo "$translation_files" > ./translation_files.txt + fi + - id: translation-check + run: | + translation_files=$(cat ./translation_files.txt) + if [ -z "$translation_files" ]; then + echo "No translation files changed" + else + if [ $(echo "$translation_files" | wc -l) -gt 1 ]; then + echo "More than one translation file changed" + exit 1 + else + echo "translation=$translation_files" >> $GITHUB_OUTPUT + # Does this file exist in the commit ${{ github.event.pull_request.base.sha }}? + if $(git show ${{ github.event.pull_request.base.sha }}:$translation_files > /dev/null 2>&1); then + echo "status=update" >> $GITHUB_OUTPUT + else + echo "status=translation" >> $GITHUB_OUTPUT + fi + fi + fi + languagetool: + if: ${{ needs.prepare.outputs.translation != '' }} + name: runner / languagetool + needs: [prepare] + outputs: + has_mistakes: ${{ steps.check-spelling.outputs.has_mistakes }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Remove code blocks + run: | + file=${{ needs.prepare.outputs.translation }} + sed -i '/```/,/```/d' $file + # Strip all macros + - id: strip-macros + run: | + file=${{ needs.prepare.outputs.translation }} + # Remove all macros with no arguments + sed -i 's/{{[a-zA-Z_-]*}}//' $file + # Replace macros with one argument + sed -i 's/{{[[:alnum:]_-]*(\("[[:alnum:]_-]*"\))}}/\1/g' $file + # Replace macros with two arguments + sed -i 's/{{[[:alnum:]_-]*(\("[[:alnum:]_-]*"\), \("[[:alnum:]_-]*"\))}}/\2/g' $file + # Replace macros with more than two arguments + sed -i 's/{{[[:alnum:]_-]*(\("[[:alnum:]_-]*"\), \("[[:alnum:]_-]*"\), \("[[:alnum:]_-]*"\))}}/\2/g' $file + # Reduce markdown to plain text + - run: sudo apt install pandoc -y + - id: md2txt + name: Convert markdown to plain text + run: | + file=${{ needs.prepare.outputs.translation }} + tmpHtmlFile=$(echo $file | sed 's/\.md/\.html/') + pandoc -f markdown -t html -o $tmpHtmlFile $file + newFileName=$(echo $file | sed 's/\.md/\.txt/') + pandoc -f html -t plain -o $newFileName $tmpHtmlFile + echo "translation=$newFileName" >> $GITHUB_OUTPUT + echo $newFileName + - if: steps.md2txt.outputs.translation == '' + name: Check translation is found + run: echo "No translation file found" && exit 1 + - uses: actions/setup-java@v3 + with: + distribution: "temurin" + java-version: "8" + - name: Download LanguageTool + run: wget -q https://languagetool.org/download/LanguageTool-6.3.zip + - name: Unzip LanguageTool + run: unzip -qq LanguageTool-6.3.zip + - name: Add spelling additions + run: | + cat uk_spelling_additions.txt >> ./LanguageTool-6.3/org/languagetool/resource/uk/hunspell/spelling.txt + cat uk_ignore_additions.txt >> ./LanguageTool-6.3/org/languagetool/resource/uk/hunspell/ignore.txt + - id: disabled-rules + name: Determine disabled rules + run: echo "disabled_rules=$(cat disabled_rules.txt | tr '\n' ',')" >> $GITHUB_OUTPUT + - id: check-spelling + name: Check spelling + run: | + cd LanguageTool-6.3 + java -jar languagetool-commandline.jar -d ${{steps.disabled-rules.outputs.disabled_rules}} -l uk --json ../${{ steps.md2txt.outputs.translation }} > ../result.json + cat ../result.json + matches=$(cat ../result.json | jq '.matches') + # Check if matches equal [] + echo "has_mistakes=$(if [ "$matches" == "[]" ]; then echo "false"; else echo "true"; fi)" >> $GITHUB_OUTPUT + - name: Upload result.json + uses: actions/upload-artifact@v3 + with: + name: result + path: result.json + - name: Upload text file + uses: actions/upload-artifact@v3 + with: + name: text + path: ${{ steps.md2txt.outputs.translation }} + report-spelling: + if: ${{ needs.languagetool.outputs.has_mistakes != 'false' }} + name: Report spelling + needs: [prepare, languagetool] + permissions: + contents: read + pull-requests: write + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v3 + with: + name: result + path: . + - uses: actions/setup-node@v4 + with: + node-version: "16" + - uses: actions/download-artifact@v3 + with: + name: text + path: . + - name: Create mapping + run: node scripts/create-file-mapping.js ./index.txt ${{ needs.prepare.outputs.translation }} > ./mapping.json && cat ./mapping.json + - env: + COMMIT_ID: ${{ github.event.pull_request.head.sha }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_NUMBER: ${{ github.event.pull_request.number }} + name: Send results + run: node scripts/send-comments.js ${{ needs.prepare.outputs.translation }} + timeout-minutes: 5 + - name: Exit with error + run: echo "Spelling errors found" && cat result.json && exit 1 + set-title: + if: ${{ needs.prepare.outputs.translation != '' }} + name: Set title + needs: [prepare] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - id: determine + run: | + translation=${{ needs.prepare.outputs.translation }} + # Trim files/uk/ from the beginning of the path + translation=${translation#files/uk/} + # Trim index.md from the end of the path + translation=${translation%/index.md} + echo "slug=$translation" >> $GITHUB_OUTPUT + # Set the topmost folder as a section + section=$(echo $translation | cut -d'/' -f1) + # if section is "web", switch to the second folder + section=$(if [ "$section" == "web" ]; then echo $(echo $translation | cut -d'/' -f2); else echo "$section"; fi) + # if section is "javascript", set it to "JS" + section=$(if [ "$section" == "javascript" ]; then echo "JS"; else echo "$section"; fi) + # if section is "css", set it to "CSS" + section=$(if [ "$section" == "css" ]; then echo "CSS"; else echo "$section"; fi) + # if section is "html", set it to "HTML" + section=$(if [ "$section" == "html" ]; then echo "HTML"; else echo "$section"; fi) + # if section is "svg", set it to "SVG" + section=$(if [ "$section" == "svg" ]; then echo "SVG"; else echo "$section"; fi) + # otherwise, just capitalize the first letter + section=$(echo $section | sed 's/\b\(.\)/\u\1/g') + echo "section=$section" >> $GITHUB_OUTPUT + - env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh pr edit ${{ github.event.pull_request.number }} --title "${{ needs.prepare.outputs.status }}(${{ steps.determine.outputs.section }}): ${{ steps.determine.outputs.slug }}" + set-translation-body: + if: ${{ needs.prepare.outputs.translation != '' && needs.prepare.outputs.status == 'translation' }} + name: Set translation body + needs: [prepare] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + # set the last section of slug as name + - id: create-body + run: | + translation=${{ needs.prepare.outputs.translation }} + # get "slug" frontmatter value + slug=$(cat $translation | grep -E "^slug: " | sed 's/slug: //') + # get "title" frontmatter value + title=$(cat $translation | grep -E "^title: " | sed 's/title: //') + # escape HTML entities from title + title=$(echo $title | sed 's//\>/g') + # replace "/uk/" with "/en-us/" in translation + original=$(echo $translation | sed 's/\/uk\//\/en-us\//') + body="Оригінальний вміст: [$title@MDN](https://developer.mozilla.org/en-us/docs/$slug), [сирці $title@GitHub](https://github.com/mdn/content/blob/main/$original)" + echo $body + echo $body > ./body.md + - env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh pr edit ${{ github.event.pull_request.number }} --body "$(cat ./body.md)" + set-update-body: + if: ${{ needs.prepare.outputs.translation != '' && needs.prepare.outputs.status == 'update' }} + name: Set update body + needs: [prepare] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + # We need latest commit in master, not PR commit + ref: master + - id: get-latest-commit-time + name: Get latest commit time + run: | + latest_commit_time=$(git log -1 --format=%ct -- ${{ needs.prepare.outputs.translation }}) + echo "latest_commit_time=$latest_commit_time" >> $GITHUB_OUTPUT + - name: Checkout original content + uses: actions/checkout@v4 + with: + repository: mdn/content + path: original + fetch-depth: 0 + - id: get-new-commits + name: Get new commits + # Get new commits sha for $translation file + run: | + original=${{ needs.prepare.outputs.translation }} + # replace /uk/ with /en-us/ in original + original=$(echo $original | sed 's/\/uk\//\/en-us\//') + cd ./original + git log --pretty=format:"%H" --since=${{steps.get-latest-commit-time.outputs.latest_commit_time}} -- $original > ../new_commits.txt + cat ../new_commits.txt + - id: create-body + run: | + translation=${{ needs.prepare.outputs.translation }} + # get "slug" frontmatter value + slug=$(cat $translation | grep -E "^slug: " | sed 's/slug: //') + # get "title" frontmatter value + title=$(cat $translation | grep -E "^title: " | sed 's/title: //') + # escape HTML entities from title + title=$(echo $title | sed 's//\>/g') + # replace "/uk/" with "/en-us/" in translation + original=$(echo $translation | sed 's/\/uk\//\/en-us\//') + echo "Оригінальний вміст: [$title@MDN](https://developer.mozilla.org/en-us/docs/$slug), [сирці $title@GitHub](https://github.com/mdn/content/blob/main/$original)" > ./body.md + echo "" >> ./body.md + echo "Нові зміни:" >> ./body.md + # Add commits from ./new_commits.txt to body as links + commits=$(cat ./new_commits.txt) + for commit in $commits + do + echo "- [$(cd ./original && git log -1 --format=%s $commit)](https://github.com/mdn/content/commit/$commit)" >> ./body.md + done + cat ./body.md + + - env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh pr edit ${{ github.event.pull_request.number }} --body "$(cat ./body.md)" diff --git a/.markdownlint-cli2.jsonc b/.markdownlint-cli2.jsonc index 9d53c13ca8..5e01c3a409 100644 --- a/.markdownlint-cli2.jsonc +++ b/.markdownlint-cli2.jsonc @@ -1,258 +1,6 @@ { "config": { - "default": true, - // Disabled, as some callouts include headings. - "header-increment": false, - "ul-style": { - "style": "dash" - }, - "ul-indent": { - "indent": 2 - }, - "no-hard-tabs": { - "spaces_per_tab": 2 - }, - "line-length": false, - "no-duplicate-header": { - "allow_different_nesting": true - }, - "single-title": { - "front_matter_title": "^\\s*title\\s*[:=]" - }, - "no-trailing-punctuation": { - "punctuation": ".,;:" - }, - // Consecutive Notes/Callouts currently don't conform with this rule - "no-blanks-blockquote": false, - // Force ordered numbering to catch accidental list ending from indenting - "ol-prefix": { - "style": "ordered" - }, - "no-inline-html": { - "allowed_elements": [ - "a", - "abbr", - "annotation", - "br", - "caption", - "code", - "col", - "colgroup", - "dd", - "details", - "div", - "dl", - "dt", - "em", - "h4", - "h5", - "img", - "kbd", - "li", - "math", - "menclose", - "mfenced", - "mfrac", - "mfrac", - "mi", - "mmultiscripts", - "mn", - "mo", - "mover", - "mphantom", - "mprescripts", - "mroot", - "mrow", - "ms", - "mspace", - "mspace", - "msqrt", - "mstyle", - "msub", - "msubsup", - "msup", - "mtable", - "mtd", - "mtext", - "mtr", - "munder", - "munderover", - "none", - "ol", - "p", - "pre", - "q", - "section", - "semantics", - "strong", - "sub", - "summary", - "sup", - "table", - "tbody", - "td", - "tfoot", - "th", - "thead", - "tr", - "ul", - "var" - ] - }, - "no-bare-urls": false, - // Produces too many false positives - "no-space-in-emphasis": false, - "fenced-code-language": true, - // See https://github.com/mdn/content/pull/20026, as macros currently break this - "no-empty-links": false, - "code-block-style": { - "style": "fenced" - }, - "emphasis-style": { - "style": "underscore" - }, - "strong-style": { - "style": "asterisk" - }, - // Disabled, as yari generates link fragments by replacing spaces with underscores, not dashes. - "link-fragments": false, - - // https://github.com/OnkarRuikar/markdownlint-rule-search-replace - "search-replace": { - "rules": [ - { - "name": "curly-double-quotes", - "message": "Don't use curly double quotes", - "searchPattern": "/“|”/g", - "replace": "\"", - "searchScope": "text" - }, - { - "name": "curly-single-quotes", - "message": "Don't use curly single quotes", - "searchPattern": "/‘|’/g", - "replace": "'", - "searchScope": "text" - }, - { - "name": "nbsp", - "message": "Don't use no-break spaces", - "searchPattern": "/ /g", - "replace": " ", - "searchScope": "all" - }, - { - "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": "/([\\(\"])en-US\\/docs/g", - "replace": "$1/en-US/docs", - "searchScope": "text" - }, - { - "name": "relative-link-path", - "message": "Don't use relative paths", - "search": "](..", - "searchScope": "text" - }, - { - "name": "trailing-spaces", - "message": "Avoid trailing spaces", - "searchPattern": "/ +$/gm", - "replace": "", - "searchScope": "all" - }, - { - "name": "no-en-us-link", - "message": "Internal links should lead to '/uk'", - "search": "/en-US/docs", - "replace": "/uk/docs", - "searchScope": "text" - }, - { - "name": "no-macros-space-before", - "message": "There shouldn't be any space after {{ for macros", - "search": "{{ ", - "replace": "{{", - "searchScope": "text" - }, - { - "name": "no-macros-space-after", - "message": "There shouldn't be any space before }} for macros", - "search": " }}", - "replace": "}}", - "searchScope": "text" - }, - { - "name": "double-spaces", - "message": "Avoid double spaces", - "searchPattern": "/([^\\s>]) ([^\\s|])/g", - "replace": "$1 $2", - "searchScope": "text" - }, - { - "name": "stuck-definition", - "message": "Character is stuck to definition description marker", - "searchPattern": "/- :(\\w)/g", - "replace": "- : $1", - "searchScope": "text" - }, - { - "name": "fqdn-moz-links", - "message": "Don't use developer.mozilla.org for links, except for blog posts", - "searchPattern": "/\\]\\(https:\\/\\/developer.mozilla.org\\/(?!en-US\\/blog\\/)/g", - "replace": "](/", - "searchScope": "text" - }, - { - "name": "fqdn-wd-links", - "message": "Don't use webdoky.org for links", - "search": "](https://webdoky.org.org/", - "replace": "](/", - "searchScope": "text" - }, - { - "name": "no-en-us-lt-link", - "message": "Internal links should lead to '/uk'", - "search": "(]) ([^\\s|])/g", + "replace": "$1 $2", + "searchScope": "text" + }, + { + "name": "stuck-definition", + "message": "Character is stuck to definition description marker", + "searchPattern": "/- :(\\w)/g", + "replace": "- : $1", + "searchScope": "text" + }, + { + "name": "fqdn-moz-links", + "message": "Don't use developer.mozilla.org for links, except for blog posts", + "searchPattern": "/\\]\\(https:\\/\\/developer.mozilla.org\\/(?!en-US\\/blog\\/)/g", + "replace": "](/", + "searchScope": "text" + }, + { + "name": "fqdn-wd-links", + "message": "Don't use webdoky.org for links", + "search": "](https://webdoky.org.org/", + "replace": "](/", + "searchScope": "text" + }, + { + "name": "no-en-us-lt-link", + "message": "Internal links should lead to '/uk'", + "search": "(Дозволені батьківські елементи Будь-який елемент, що приймає - оповідальний вміст, або будь-який елемент, що приймає потоковий елементпотоковий вміст, але не інший елемент <a>. diff --git a/files/uk/web/html/element/link/index.md b/files/uk/web/html/element/link/index.md index 6ae91accfd..fb4daa0fe8 100644 --- a/files/uk/web/html/element/link/index.md +++ b/files/uk/web/html/element/link/index.md @@ -377,7 +377,12 @@ browser-compat: html.elements.link В атрибуті `blocking` можна задати лексему `render`; тоді візуалізація сторінки буде заблокована, поки ресурс не отримано. Наприклад: ```html - + ``` ## Технічний підсумок diff --git a/front-matter-config.json b/front-matter-config.json index ffcc9ec69f..36a84cb813 100644 --- a/front-matter-config.json +++ b/front-matter-config.json @@ -4,7 +4,7 @@ "title": "Front matter schema", "type": "object", "additionalProperties": false, - "required": ["title", "slug"], + "required": ["title", "slug", "page-type"], "properties": { "title": { "title": "Title", @@ -290,6 +290,31 @@ }, "else": false }, + { + "if": { + "properties": { + "slug": { "type": "string", "pattern": "^WebAssembly/" } + } + }, + "then": { + "properties": { + "page-type": { + "enum": [ + "guide", + "landing-page", + "webassembly-function", + "webassembly-constructor", + "webassembly-interface", + "webassembly-instance-property", + "webassembly-instance-method", + "webassembly-static-method", + "webassembly-instruction" + ] + } + } + }, + "else": false + }, { "if": { "properties": { diff --git a/package.json b/package.json index 28d7bae74d..7d0943211f 100644 --- a/package.json +++ b/package.json @@ -4,12 +4,12 @@ "@caporal/core": "^2.0.7", "ajv": "^8.12.0", "ajv-formats": "^2.1.1", - "async": "^3.2.4", + "async": "^3.2.5", "axios": "0.23.0", "chalk": "~4.1.2", "cli-progress": "^3.12.0", "cross-env": "7.0.3", - "fdir": "^6.1.0", + "fdir": "^6.1.1", "glob": "~7.1.7", "gray-matter": "^4.0.3", "html-to-text": "~8.0.0", @@ -60,10 +60,10 @@ "eslint-plugin-unicorn": "^48.0.1", "husky": "8.0.3", "jest": "^29.7.0", - "lint-staged": "14.0.1", - "markdownlint-cli2": "0.9.2", + "lint-staged": "^14.0.1", + "markdownlint-cli2": "0.10.0", "markdownlint-rule-search-replace": "1.2.0", - "prettier": "3.0.3", + "prettier": "3.1.0", "typescript": "^5.2.2" } } diff --git a/scripts/send-comments.js b/scripts/send-comments.js index 9404d39b76..0f7d1942ad 100644 --- a/scripts/send-comments.js +++ b/scripts/send-comments.js @@ -124,7 +124,25 @@ try { console.log(command); // command = command.replaceAll("\n", "\\\n"); console.log(`GH_TOKEN=${process.env.GH_TOKEN} ${command}`); - execSync(command, { stdio: "inherit", timeout: 60_000 }); + try { + execSync(command, { stdio: "inherit", timeout: 60_000 }); + } catch (error) { + console.error(error); + // Try to send non-line comment + let genericCommentCommand = `gh api repos/${process.env.GITHUB_REPOSITORY}/issues/${process.env.PR_NUMBER}/comments`; + delete parameters.start_line; + delete parameters.start_side; + delete parameters.line; + delete parameters.side; + // eslint-disable-next-line no-restricted-syntax + for (const [key, value] of Object.entries(parameters)) { + genericCommentCommand += + typeof value === "number" + ? ` -F ${key}=${value}` + : ` -f ${key}="${value}"`; + } + execSync(genericCommentCommand, { stdio: "inherit", timeout: 60_000 }); + } } clearTimeout(timeout); } catch (error) { diff --git a/yarn.lock b/yarn.lock index 3af660405d..5ea5558a2d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1138,11 +1138,16 @@ astral-regex@^1.0.0: resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" integrity sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg== -async@^3.2.3, async@^3.2.4: +async@^3.2.3: version "3.2.4" resolved "https://registry.yarnpkg.com/async/-/async-3.2.4.tgz#2d22e00f8cddeb5fde5dd33522b56d1cf569a81c" integrity sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ== +async@^3.2.5: + version "3.2.5" + resolved "https://registry.yarnpkg.com/async/-/async-3.2.5.tgz#ebd52a8fdaf7a2289a24df399f8d8485c8a46b66" + integrity sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg== + available-typed-arrays@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz#92f95616501069d07d10edb2fc37d3e1c65123b7" @@ -2339,10 +2344,10 @@ fb-watchman@^2.0.0: dependencies: bser "2.1.1" -fdir@^6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/fdir/-/fdir-6.1.0.tgz#e5813b659e14671994e21287dae0f61fec8f9a62" - integrity sha512-274qhz5PxNnA/fybOu6apTCUnM0GnO3QazB6VH+oag/7DQskdYq8lm07ZSm90kEQuWYH5GvjAxGruuHrEr0bcg== +fdir@^6.1.1: + version "6.1.1" + resolved "https://registry.yarnpkg.com/fdir/-/fdir-6.1.1.tgz#316b58145a05223b75c8b371e80bb3bad8f1441e" + integrity sha512-QfKBVg453Dyn3mr0Q0O+Tkr1r79lOTAKSi9f/Ot4+qVEwxWhav2Z+SudrG9vQjM2aYRMQQZ2/Q1zdA8ACM1pDg== fecha@^4.2.0: version "4.2.3" @@ -3539,7 +3544,7 @@ linkify-it@^4.0.1: dependencies: uc.micro "^1.0.1" -lint-staged@14.0.1: +lint-staged@^14.0.1: version "14.0.1" resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-14.0.1.tgz#57dfa3013a3d60762d9af5d9c83bdb51291a6232" integrity sha512-Mw0cL6HXnHN1ag0mN/Dg4g6sr8uf8sn98w2Oc1ECtFto9tvRF7nkXGJRbx8gPlHyoR0pLyBr2lQHbWwmUHe1Sw== @@ -3669,17 +3674,17 @@ markdownlint-cli2-formatter-default@0.0.4: resolved "https://registry.yarnpkg.com/markdownlint-cli2-formatter-default/-/markdownlint-cli2-formatter-default-0.0.4.tgz#81e26b0a50409c0357c6f0d38d8246946b236fab" integrity sha512-xm2rM0E+sWgjpPn1EesPXx5hIyrN2ddUnUwnbCsD/ONxYtw3PX6LydvdH6dciWAoFDpwzbHM1TO7uHfcMd6IYg== -markdownlint-cli2@0.9.2: - version "0.9.2" - resolved "https://registry.yarnpkg.com/markdownlint-cli2/-/markdownlint-cli2-0.9.2.tgz#ed714905e0e4ce583e5c3d95134ba1e2d0287552" - integrity sha512-ndijEHIOikcs29W8068exHXlfkFviGFT/mPhREia7zSfQzHvTDkL2s+tWizvELjLHiKRO4KGTkkJyR3oeR8A5g== +markdownlint-cli2@0.10.0: + version "0.10.0" + resolved "https://registry.yarnpkg.com/markdownlint-cli2/-/markdownlint-cli2-0.10.0.tgz#4ba94b6cc648eb62475432ebcc19557afcdd487b" + integrity sha512-kVxjPyKFC+eW7iqcxiNI50RDzwugpXkEX5eQlDso/0IUs9M73jXYguLFHDzgi5KatcxU/57Fu8KoGtkFft9lfA== dependencies: globby "13.2.2" - markdownlint "0.30.0" + markdownlint "0.31.1" markdownlint-cli2-formatter-default "0.0.4" micromatch "4.0.5" strip-json-comments "5.0.1" - yaml "2.3.1" + yaml "2.3.2" markdownlint-micromark@0.1.2: version "0.1.2" @@ -3705,10 +3710,10 @@ markdownlint-rule-search-replace@1.2.0: dependencies: markdownlint-rule-helpers "0.21.0" -markdownlint@0.30.0: - version "0.30.0" - resolved "https://registry.yarnpkg.com/markdownlint/-/markdownlint-0.30.0.tgz#e5b43f794c6810299cd4be86f8d54108e9169860" - integrity sha512-nInuFvI/rEzanAOArW5490Ez4EYpB5ODqVM0mcDYCPx9DKJWCQqCgejjiCvbSeE7sjbDscVtZmwr665qpF5xGA== +markdownlint@0.31.1: + version "0.31.1" + resolved "https://registry.yarnpkg.com/markdownlint/-/markdownlint-0.31.1.tgz#f014ed2d3614c5dbc351b7f65641ccc0a5facdb7" + integrity sha512-CKMR2hgcIBrYlIUccDCOvi966PZ0kJExDrUi1R+oF9PvqQmCrTqjOsgIvf2403OmJ+CWomuzDoylr6KbuMyvHA== dependencies: markdown-it "13.0.1" markdownlint-micromark "0.1.7" @@ -4119,10 +4124,10 @@ prettier-linter-helpers@^1.0.0: dependencies: fast-diff "^1.1.2" -prettier@3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.0.3.tgz#432a51f7ba422d1469096c0fdc28e235db8f9643" - integrity sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg== +prettier@3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.1.0.tgz#c6d16474a5f764ea1a4a373c593b779697744d5e" + integrity sha512-TQLvXjq5IAibjh8EpBIkNKxO749UEWABoiIZehEPiY4GNpVdhaFKqSTu+QrlU6D2dPAfubRmtJTi4K4YkQ5eXw== pretty-format@^29.7.0: version "29.7.0" @@ -5143,6 +5148,11 @@ yaml@2.3.1: resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.3.1.tgz#02fe0975d23cd441242aa7204e09fc28ac2ac33b" integrity sha512-2eHWfjaoXgTBC2jNM1LRef62VQa0umtvRiDSk6HSzW7RvS5YtkabJrwYLLEKWBc8a5U2PTSCs+dJjUTJdlHsWQ== +yaml@2.3.2: + version "2.3.2" + resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.3.2.tgz#f522db4313c671a0ca963a75670f1c12ea909144" + integrity sha512-N/lyzTPaJasoDmfV7YTrYCI0G/3ivm/9wdG0aHuheKowWQwGTsK0Eoiw6utmzAnI6pkJa0DUVygvp3spqqEKXg== + yargs-parser@^21.1.1: version "21.1.1" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35"