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

Emoji deprecation warning #104

Merged
merged 5 commits into from
Sep 30, 2024
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
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
Loading