Skip to content

Commit

Permalink
Merge branch 'master' into drivers2416-oidc-azure
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 committed Mar 13, 2024
2 parents ddbc70e + d036675 commit edf07ff
Show file tree
Hide file tree
Showing 704 changed files with 89,257 additions and 44,178 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ logo.png
codereview.rc
.idea/**
docs_build
.pytest_cache
node_modules
package-lock.json
17 changes: 16 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,25 @@ repos:
args: ["--severity=error"]
stages: [manual]

- repo: local
hooks:
- id: generate-index
name: generate-index
entry: python3 scripts/generate_index.py
language: system
- id: check-anchors
name: check-anchors
types: [markdown]
entry: bash scripts/check_anchors/check-anchors.sh
language: node

- repo: https://github.com/executablebooks/mdformat
rev: 0.7.17
hooks:
- id: mdformat
args: ["--wrap=120", "--number"]
additional_dependencies:
[mdformat-gfm, mdformat-frontmatter, mdformat-footnote]
[mdformat-gfm, mdformat-frontmatter, mdformat-footnote, mdformat-gfm-alerts]

- repo: https://github.com/tcort/markdown-link-check
rev: v3.11.2
Expand Down Expand Up @@ -61,3 +73,6 @@ repos:
hooks:
- id: codespell
args: ["-L", "fle,re-use,merchantibility,synching,crate,nin,infinit,te"]
exclude: |
(?x)^(.*\.rst
)$
9 changes: 9 additions & 0 deletions markdown_link_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@
},
{
"pattern": "^https://github.com/10gen/mongo-enterprise-modules"
},
{
"pattern": "^https://github.com/10gen/mongohouse"
},
{
"pattern": "cloudkms.googleapis.com"
},
{
"pattern": "subtype6#intent-to-encrypt"
}
]
}
4 changes: 4 additions & 0 deletions scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,7 @@ python3 scripts/migrate_to_md.py "source/<path_to_rst_file>"
- Remove the rst file using `git rm`.

- Create a PR. When you commit the changes, the `mdformat` `pre-commit` hook will update the formatting as appropriate.

## generate_index

Use this file to generate the top level Markdown index file. It is independent to be used as a pre-commit hook.
8 changes: 8 additions & 0 deletions scripts/check_anchors/check-anchors.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash -ex

SCRIPT_DIR=$(dirname ${BASH_SOURCE[0]})
SCRIPT_DIR="$( cd -- "$SCRIPT_DIR" &> /dev/null && pwd )"
pushd $SCRIPT_DIR
npm install
popd
node $SCRIPT_DIR/index.js "$@"
34 changes: 34 additions & 0 deletions scripts/check_anchors/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const fs = require("fs");
const showdown = require('showdown');
const jsdom = require("jsdom");

showdown.setFlavor('github');
const converter = new showdown.Converter();

const files = process.argv.slice(2);

for (let path of files) {
console.log("Checking file", path);
const text = fs.readFileSync(path, {encoding: "utf-8"});
const html = converter.makeHtml(text);
const dom = new jsdom.JSDOM(html);
const doc = dom.window.document;
const links = doc.querySelectorAll("a");
const errors = [];
for (var i = 0; i < links.length; i++) {
var link = links[i].getAttribute("href");
if (link.startsWith('#')) {
if (!doc.getElementById(link.slice(1))) {
console.log('Could not find', link);
errors.push(link)
}
}
}
if (errors.length > 0) {
const all = doc.querySelectorAll('*[id]');
for (var i = 0; i < all.length; i ++ ) {
console.log(all[i].id);
}
process.exit(1);
}
}
Loading

0 comments on commit edf07ff

Please sign in to comment.