Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
docs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
core
docs
Commits
df29f766
Commit
df29f766
authored
1 year ago
by
Artur Sabirov
Browse files
Options
Downloads
Patches
Plain Diff
chore: fix linting errors in hooks
parent
234051ce
No related branches found
No related tags found
1 merge request
!315
feat: check svg attributes
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
hooks/check_headers.py
+4
-4
4 additions, 4 deletions
hooks/check_headers.py
hooks/check_links.py
+1
-1
1 addition, 1 deletion
hooks/check_links.py
with
5 additions
and
5 deletions
hooks/check_headers.py
+
4
−
4
View file @
df29f766
...
...
@@ -13,13 +13,13 @@ log = get_plugin_logger(os.path.basename(__file__))
# https://www.mkdocs.org/dev-guide/plugins/#events
# https://github.com/mkdocs/mkdocs/blob/1.5.3/mkdocs/commands/build.py#L258
def
on_files
(
files
:
Files
,
config
:
MkDocsConfig
):
anchors
=
dict
()
anchors
:
dict
[
str
,
list
[
str
]]
=
dict
()
config
[
"
anchors
"
]
=
anchors
for
file
in
files
.
documentation_pages
():
log
.
debug
(
file
.
src_path
)
Page
(
None
,
file
,
config
)
Page
(
None
,
file
,
config
)
assert
file
.
page
is
not
None
file
.
page
.
read_source
(
config
)
...
...
@@ -27,9 +27,9 @@ def on_files(files: Files, config: MkDocsConfig):
markdown
:
str
=
file
.
page
.
markdown
lines
:
list
[
str
]
=
re
.
sub
(
"
<!--.*?-->
"
,
""
,
markdown
,
flags
=
re
.
DOTALL
).
split
(
"
\n
"
)
headers
:
list
[
str
]
=
filter
(
lambda
line
:
re
.
match
(
"
^##+
"
,
line
),
lines
)
headers
:
list
[
str
]
=
list
(
filter
(
lambda
line
:
re
.
match
(
"
^##+
"
,
line
),
lines
)
)
file_anchors
=
list
()
file_anchors
:
list
[
str
]
=
list
()
anchors
[
file
.
src_path
]
=
file_anchors
for
line
in
headers
:
...
...
This diff is collapsed.
Click to expand it.
hooks/check_links.py
+
1
−
1
View file @
df29f766
...
...
@@ -12,7 +12,7 @@ log = get_plugin_logger(os.path.basename(__file__))
# https://www.mkdocs.org/dev-guide/plugins/#events
def
on_page_markdown
(
markdown
:
str
,
page
:
Page
,
config
:
MkDocsConfig
,
files
:
Files
):
markdown
:
str
=
re
.
sub
(
"
<!--.*?-->
"
,
""
,
markdown
,
flags
=
re
.
DOTALL
)
markdown
=
re
.
sub
(
"
<!--.*?-->
"
,
""
,
markdown
,
flags
=
re
.
DOTALL
)
for
match
in
re
.
finditer
(
r
"
(!?)\[([^\[\]]*?)\]\((.+?)\)
"
,
markdown
,
flags
=
re
.
DOTALL
):
link
=
match
[
0
].
replace
(
"
\n
"
,
"
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment