Skip to content

Commit

Permalink
Merge pull request #104 from BalzaniEdoardo/emoji_deprecation_warning
Browse files Browse the repository at this point in the history
Emoji deprecation warning
  • Loading branch information
smarie authored Sep 30, 2024
2 parents de81b0c + 61395ec commit 0ae7dd7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
4 changes: 4 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

### 0.10.4 - Bugfixes

- Emoji logic updated. Fixes [#103](https://github.com/smarie/mkdocs-gallery/issues/103).

### 0.10.3 - Bugfixes

- Don't use `asyncio.run` for async handling. Fixes [#93](https://github.com/smarie/mkdocs-gallery/issues/93).
Expand Down
15 changes: 11 additions & 4 deletions src/mkdocs_gallery/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
The mkdocs plugin entry point
"""
import os
from os.path import relpath
import platform
import re
from os.path import relpath
from pathlib import Path
from typing import Any, Dict, List, Union

Expand All @@ -20,6 +21,7 @@
from mkdocs.structure.files import Files
from mkdocs.structure.pages import Page
from packaging import version
from packaging.version import parse as parse_version

from . import glr_path_static
from .binder import copy_binder_files
Expand All @@ -28,6 +30,8 @@
from .gen_gallery import fill_mkdocs_nav, generate_gallery_md, parse_config, summarize_failing_examples
from .utils import is_relative_to

IS_PY37 = parse_version("3.7") <= parse_version(platform.python_version()) < parse_version("3.8")

mkdocs_version = version.parse(mkdocs_version_str)
is_mkdocs_14_or_greater = mkdocs_version >= version.parse("1.4")

Expand Down Expand Up @@ -207,7 +211,10 @@ def on_config(self, config, **kwargs):
if "toc.integrate" not in config["theme"]["features"]:
config["theme"]["features"].append("navigation.indexes")

extra_config_yml = """
# Set Python version dependent emoji logic for backward compatibility
mx_name = "materialx" if IS_PY37 else "material.extensions"

extra_config_yml = f"""
markdown_extensions:
# to declare attributes such as css classes on markdown elements. For example to change the color
- attr_list
Expand All @@ -224,8 +231,8 @@ def on_config(self, config, **kwargs):
# to have the download icons in the buttons
- pymdownx.emoji:
emoji_index: !!python/name:materialx.emoji.twemoji
emoji_generator: !!python/name:materialx.emoji.to_svg
emoji_index: !!python/name:{mx_name}.emoji.twemoji
emoji_generator: !!python/name:{mx_name}.emoji.to_svg
"""
Expand Down

0 comments on commit 0ae7dd7

Please sign in to comment.