Skip to content

Commit

Permalink
Merge in upstream changes from mkdocs-material
Browse files Browse the repository at this point in the history
This replaces the modified Sphinx search implementation with the
lunr.js-based search implementation from the upstream mkdocs-material
theme.
  • Loading branch information
jbms committed Apr 11, 2024
1 parent 63a80bb commit 0ef5fc7
Show file tree
Hide file tree
Showing 365 changed files with 21,796 additions and 20,441 deletions.
6 changes: 1 addition & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2016-2022 Martin Donath <[email protected]>
# Copyright (c) 2016-2024 Martin Donath <[email protected]>

# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
Expand Down Expand Up @@ -30,10 +30,6 @@ end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

# Markdown
[*.md]
trim_trailing_whitespace = false

# Python
[*.py]
indent_style = space
Expand Down
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2016-2022 Martin Donath <[email protected]>
# Copyright (c) 2016-2024 Martin Donath <[email protected]>

# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
Expand Down
3 changes: 1 addition & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
],
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-extraneous-class": "error",
"@typescript-eslint/no-misused-promises": "error",
"@typescript-eslint/no-misused-promises": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-parameter-properties": "off",
"@typescript-eslint/no-floating-promises": "error",
Expand Down Expand Up @@ -320,7 +320,6 @@
}
],
"jsdoc/empty-tags": "warn",
"jsdoc/newline-after-description": "warn",
"jsdoc/no-bad-blocks": "warn",
"jsdoc/no-defaults": "warn",
"jsdoc/no-types": "warn",
Expand Down
2 changes: 1 addition & 1 deletion .stylelintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2016-2022 Martin Donath <[email protected]>
# Copyright (c) 2016-2024 Martin Donath <[email protected]>

# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
Expand Down
46 changes: 26 additions & 20 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"extends": [
"stylelint-config-rational-order",
"stylelint-config-recess-order",
"stylelint-config-recommended",
"stylelint-config-standard-scss"
"stylelint-config-standard-scss",
"stylelint-stylistic/config"
],
"plugins": [
"stylelint-scss"
Expand Down Expand Up @@ -32,16 +33,6 @@
}
],
"at-rule-no-unknown": null,
"block-closing-brace-newline-after": [
"always",
{
"ignoreAtRules": [
"if",
"else",
"elseif"
]
}
],
"color-function-notation": null,
"color-hex-length": "long",
"color-named": "never",
Expand All @@ -58,23 +49,23 @@
"declaration-colon-space-after": null,
"declaration-no-important": true,
"declaration-block-single-line-max-declarations": 0,
"font-family-name-quotes": "always-where-recommended",
"font-weight-notation": "numeric",
"function-calc-no-unspaced-operator": null,
"function-no-unknown": null,
"function-url-no-scheme-relative": true,
"function-url-quotes": "always",
"font-family-name-quotes": "always-where-recommended",
"font-weight-notation": "numeric",
"hue-degree-notation": "number",
"length-zero-no-unit": [
true,
{
"ignore": ["custom-properties"]
}
],
"linebreaks": "unix",
"media-feature-name-no-unknown": null,
"media-feature-range-notation": null,
"media-query-no-invalid": null,
"no-descending-specificity": null,
"no-empty-first-line": true,
"no-unknown-animations": true,
"property-no-unknown": null,
"property-no-vendor-prefix": [
Expand All @@ -90,19 +81,17 @@
"selector-combinator-space-before": null,
"selector-descendant-combinator-no-non-space": null,
"selector-id-pattern": null,
"selector-max-empty-lines": 0,
"selector-max-id": 0,
"selector-no-qualifying-type": null,
"selector-pseudo-class-no-unknown": null,
"selector-pseudo-element-no-unknown": null,
"string-quotes": "double",
"unicode-bom": "never",
"unit-allowed-list": [
"%",
"ch",
"dppx",
"deg",
"em",
"fr",
"mm",
"ms",
"px",
Expand Down Expand Up @@ -158,6 +147,23 @@
"scss/operator-no-unspaced": true,
"scss/partial-no-import": true,
"scss/percent-placeholder-pattern": "^[a-z][a-z0-9]*(-[a-z0-9]+)*$",
"scss/selector-no-redundant-nesting-selector": true
"scss/selector-no-redundant-nesting-selector": true,
"stylistic/block-closing-brace-newline-after": [
"always",
{
"ignoreAtRules": [
"if",
"else",
"elseif"
]
}
],
"stylistic/declaration-colon-space-after": null,
"stylistic/no-empty-first-line": true,
"stylistic/linebreaks": "unix",
"stylistic/selector-max-empty-lines": 0,
"stylistic/string-quotes": "double",
"stylistic/unicode-bom": "never",
"stylistic/value-list-comma-newline-after": null
}
}
2 changes: 1 addition & 1 deletion MKDOCS_MATERIAL_MERGE_BASE
Original file line number Diff line number Diff line change
@@ -1 +1 @@
f139b54c61b2df4512f15149cba2c222475e2bc9
f27b93ece3c423537873e0bc5de55b3c3381792f
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
# "navigation.tracking",
# "search.highlight",
"search.share",
"search.suggest",
"toc.follow",
"toc.sticky",
"content.tabs.link",
Expand Down
28 changes: 15 additions & 13 deletions merge_from_mkdocs_material.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,9 @@
"material",
# mkdocs-specific files
"src/**/*.py",
"src/mkdocs_theme.yml",
"src/404.html",
"src/templates/mkdocs_theme.yml",
"src/templates/404.html",
"mkdocs.yml",
# Unneeded files
"typings/lunr",
"src/assets/javascripts/browser/worker",
"src/templates/assets/javascripts/browser/worker",
"src/assets/javascripts/integrations/search/worker",
"src/templates/assets/javascripts/integrations/search/worker",
# Files specific to mkdocs' own documentation
"src/overrides",
"src/assets/images/favicon.png",
Expand All @@ -73,6 +67,10 @@
"pyproject.toml",
]

RENAMES = [
("src/plugins/search", "sphinx_immaterial/plugins/search"),
]

ap = argparse.ArgumentParser()
ap.add_argument(
"--clone-dir",
Expand Down Expand Up @@ -117,11 +115,6 @@
def _fix_package_json(path: pathlib.Path) -> None:
content = json.loads(path.read_text(encoding="utf-8"))
content.pop("version", None)
content["dependencies"].pop("lunr")
content["dependencies"].pop("fuzzaldrin-plus")
content["dependencies"].pop("lunr-languages")
content["devDependencies"].pop("@types/lunr")
content["devDependencies"].pop("@types/fuzzaldrin-plus")
path.write_text(json.dumps(content, indent=2) + "\n", encoding="utf-8")


Expand Down Expand Up @@ -161,6 +154,15 @@ def _create_adjusted_commit(
cwd=clone_dir,
check=True,
)
# Move files
for source, target in RENAMES:
os.makedirs(os.path.join(temp_workdir, os.path.dirname(target)), exist_ok=True)
subprocess.run(
["git", "mv", source, target],
cwd=temp_workdir,
check=True,
stdout=subprocess.PIPE,
)
exclude = []
# filter out exclude patterns for paths that don't exist in the temp_workdir
for pattern in MKDOCS_EXCLUDE_PATTERNS:
Expand Down
Loading

0 comments on commit 0ef5fc7

Please sign in to comment.