Skip to content

Commit

Permalink
Add standard filter normalize_url (#236)
Browse files Browse the repository at this point in the history
- This filter is imported from mkdocs.utils
  • Loading branch information
Laurent Franceschetti committed Jul 28, 2024
1 parent ec9bbb9 commit 5bec964
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions mkdocs_macros/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
Laurent Franceschetti (c) 2020
"""
from urllib.parse import urlparse
from mkdocs.structure.nav import get_navigation
from mkdocs.structure.files import File
import os
import sys
import subprocess
Expand All @@ -22,6 +20,9 @@
from functools import partial

import mkdocs
from mkdocs.structure.nav import get_navigation
from mkdocs.structure.files import File
from mkdocs.utils import normalize_url
import jinja2
from jinja2 import Template
from markdown import markdown
Expand Down Expand Up @@ -56,7 +57,7 @@ def list_items(obj):
return enumerate(list(obj))


def get_first_para(s):
def get_first_para(s) -> str:
"Get the first para of a docstring"
first_lines = []
for row in s.strip().splitlines():
Expand Down Expand Up @@ -377,3 +378,9 @@ def now():

# add fix url function as macro
env.macro(fix_url)




# add the normal mkdocs url function
env.filter(normalize_url)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# Initialization
# --------------------

VERSION_NUMBER = '1.1.1'
VERSION_NUMBER = '1.1.2'

# required if you want to run document/test
# pip install 'mkdocs-macros-plugin[test]'
Expand Down

0 comments on commit 5bec964

Please sign in to comment.