Skip to content

Commit 979a976

Browse files
author
Laurent Franceschetti
committed
Fix log filter issue with mkdocs >= 1.2 (#173)
- issue shown as warnaing since mkdocs 1.5
1 parent f33011f commit 979a976

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

mkdocs_macros/util.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
import subprocess
88
from copy import deepcopy
99
import os, sys, importlib.util
10+
from packaging.version import Version
1011

1112
from termcolor import colored
13+
import mkdocs
1214

1315
# ------------------------------------------
1416
# Trace and debug
@@ -17,9 +19,13 @@
1719
TRACE_PREFIX = 'macros'
1820

1921
import logging
20-
from mkdocs.utils import warning_filter
2122
LOG = logging.getLogger("mkdocs.plugins." + __name__)
22-
LOG.addFilter(warning_filter)
23+
24+
MKDOCS_LOG_VERSION = '1.2'
25+
if Version(mkdocs.__version__) < Version(MKDOCS_LOG_VERSION):
26+
# filter doesn't do anything since that version
27+
from mkdocs.utils import warning_filter
28+
LOG.addFilter(warning_filter)
2329

2430

2531
def format_trace(*args):

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# Initialization
1313
# --------------------
1414

15-
VERSION_NUMBER = '1.0.3'
15+
VERSION_NUMBER = '1.0.4'
1616

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

0 commit comments

Comments
 (0)