Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML-escape filenames in include-markdown comments #120

Merged
merged 4 commits into from
Sep 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 3.7.0
current_version = 3.7.1

[bumpversion:file:mkdocs_include_markdown_plugin/__init__.py]

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_SERVICE_NAME: github
- name: Test examples
run: pytest -svv tests/_test_examples.py

build-sdist:
if: startsWith(github.ref, 'refs/tags/')
Expand Down
2 changes: 1 addition & 1 deletion mkdocs_include_markdown_plugin/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__title__ = 'mkdocs_include_markdown_plugin'
__version__ = '3.7.0'
__version__ = '3.7.1'
2 changes: 1 addition & 1 deletion mkdocs_include_markdown_plugin/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ def found_include_markdown_tag(match):
start_end_part += f"'{html.escape(end)}' " if end else "'' "

return (
f'{_includer_indent}<!-- BEGIN INCLUDE {filename}'
f'{_includer_indent}<!-- BEGIN INCLUDE {html.escape(filename)}'
f' {start_end_part}-->{separator}{text_to_include}'
f'{separator}{_includer_indent}<!-- END INCLUDE -->'
)
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = mkdocs_include_markdown_plugin
version = 3.7.0
version = 3.7.1
description = Mkdocs Markdown includer plugin.
long_description = file: README.md
long_description_content_type = text/markdown
Expand Down
File renamed without changes.
15 changes: 9 additions & 6 deletions tests/test_arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@
from testing_helpers import parametrize_directives


WINDOWS_DOUBLE_QUOTES_PATHS_NOT_ALLOWED_REASON = (
'Double quotes are reserved characters not allowed for paths under Windows'
)

double_quotes_windows_path_skip = pytest.mark.skipif(
sys.platform.startswith('win'),
reason=WINDOWS_DOUBLE_QUOTES_PATHS_NOT_ALLOWED_REASON,
reason=(
'Double quotes are reserved characters not allowed for'
' paths under Windows'
),
)


Expand All @@ -25,7 +24,11 @@
(
pytest.param(
'include',
['preserve-includer-indent', 'dedent', 'trailing-newlines'],
[
'preserve-includer-indent',
'dedent',
'trailing-newlines',
],
id='include',
),
pytest.param(
Expand Down