Skip to content

Commit

Permalink
HTML-escape filenames in include-markdown comments (#120)
Browse files Browse the repository at this point in the history
* HTML-escape filenames in `include-markdown` comments

* Bump version

* Remove example

* Test examples in CI
  • Loading branch information
mondeja authored Sep 7, 2022
1 parent 31be084 commit 0c5dba6
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 10 deletions.
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

0 comments on commit 0c5dba6

Please sign in to comment.