diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 12fe173c..65f51376 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -22,7 +22,7 @@ jobs: fail-fast: false matrix: os: [ubuntu, macos] - version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + version: ["3.8", "3.9", "3.10", "3.11"] runs-on: ${{ matrix.os }}-latest steps: diff --git a/mkdocs/site_overrides/main.html b/mkdocs/site_overrides/main.html index d5f1c1e8..53de14b6 100644 --- a/mkdocs/site_overrides/main.html +++ b/mkdocs/site_overrides/main.html @@ -7,7 +7,7 @@ {% elif page and page.title and not page.is_homepage %} {% set title = title ~ " - " ~ page.title | striptags %} {% endif %} - {% set image_url = page.canonical_url ~ "" ~ config.extra.social_image %} + {% set image_url = config.site_url ~ ("" if config.site_url.endswith("/") else "/") ~ config.extra.social_image %} diff --git a/nbdev_mkdocs/__init__.py b/nbdev_mkdocs/__init__.py index 43b63174..a57ea752 100644 --- a/nbdev_mkdocs/__init__.py +++ b/nbdev_mkdocs/__init__.py @@ -1 +1 @@ -__version__ = "0.5.2rc0" +__version__ = "0.6.0rc0" diff --git a/nbdev_mkdocs/social_image_generator.py b/nbdev_mkdocs/social_image_generator.py index 69c21251..7dcc34c5 100644 --- a/nbdev_mkdocs/social_image_generator.py +++ b/nbdev_mkdocs/social_image_generator.py @@ -217,7 +217,7 @@ def _update_social_image_in_site_overrides(root_path: str, image_url: str) -> No The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen) """ _replace_str = ( - 'page.canonical_url ~ "" ~ config.extra.social_image ' + 'config.site_url ~ ("" if config.site_url.endswith("/") else "/") ~ config.extra.social_image ' if is_local_path(image_url) else "config.extra.social_image " ) diff --git a/nbs/Social_Image_Generator.ipynb b/nbs/Social_Image_Generator.ipynb index 8d8d90e5..b61583d4 100644 --- a/nbs/Social_Image_Generator.ipynb +++ b/nbs/Social_Image_Generator.ipynb @@ -404,10 +404,10 @@ "name": "stdout", "output_type": "stream", "text": [ - "Social share image generated and saved at: '/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmpl899db1l/dst_path/mkdocs/docs_overrides/images/social_image.png'\n", - "Social share image generated and saved at: '/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmpl899db1l/dst_path/mkdocs/docs_overrides/images/social_image.png'\n", - "Social share image generated and saved at: '/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmpl899db1l/dst_path/mkdocs/docs_overrides/images/social_image.png'\n", - "Social share image generated and saved at: '/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmpl899db1l/dst_path/mkdocs/docs_overrides/images/social_image.png'\n" + "Social share image generated and saved at: '/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmp16hxplap/dst_path/mkdocs/docs_overrides/images/social_image.png'\n", + "Social share image generated and saved at: '/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmp16hxplap/dst_path/mkdocs/docs_overrides/images/social_image.png'\n", + "Social share image generated and saved at: '/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmp16hxplap/dst_path/mkdocs/docs_overrides/images/social_image.png'\n", + "Social share image generated and saved at: '/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmp16hxplap/dst_path/mkdocs/docs_overrides/images/social_image.png'\n" ] } ], @@ -496,7 +496,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "Social share image generated and saved at: '/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmpzat45v9m/mkdocs/docs_overrides/images/social_image.png'\n" + "Social share image generated and saved at: '/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmp4601wh7k/mkdocs/docs_overrides/images/social_image.png'\n" ] } ], @@ -784,7 +784,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "Social share image generated and saved at: '/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmprufapjv9/mkdocs/docs_overrides/images/social_image.png'\n", + "Social share image generated and saved at: '/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmpl1wm149b/mkdocs/docs_overrides/images/social_image.png'\n", "https://my-random-domain/sample.png\n", "overrides/images/social_image.png\n", "site_name: Test site\n", @@ -897,7 +897,7 @@ " The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)\n", " \"\"\"\n", " _replace_str = (\n", - " 'page.canonical_url ~ \"\" ~ config.extra.social_image '\n", + " 'config.site_url ~ (\"\" if config.site_url.endswith(\"/\") else \"/\") ~ config.extra.social_image '\n", " if is_local_path(image_url)\n", " else \"config.extra.social_image \"\n", " )\n", @@ -940,7 +940,8 @@ " {% elif page and page.title and not page.is_homepage %}\n", " {% set title = title ~ \" - \" ~ page.title | striptags %}\n", " {% endif %}\n", - " {% set image_url = page.canonical_url ~ \"\" ~ config.extra.social_image %}\n", + " {% set trailing_slash = \"\" if config.site_url.endswith(\"/\") else \"/\" %}\n", + " {% set image_url = config.site_url ~ (\"\" if config.site_url.endswith(\"/\") else \"/\") ~ config.extra.social_image %}\n", " \n", " \n", " \n", @@ -986,7 +987,7 @@ " print(actual)\n", "\n", " assert (\n", - " '{% set image_url = page.canonical_url ~ \"\" ~ config.extra.social_image %}'\n", + " '{% set image_url = config.site_url ~ (\"\" if config.site_url.endswith(\"/\") else \"/\") ~ config.extra.social_image %}'\n", " in actual\n", " ), actual" ] @@ -1010,6 +1011,7 @@ " {% elif page and page.title and not page.is_homepage %}\n", " {% set title = title ~ \" - \" ~ page.title | striptags %}\n", " {% endif %}\n", + " {% set trailing_slash = \"\" if config.site_url.endswith(\"/\") else \"/\" %}\n", " {% set image_url = config.extra.social_image %}\n", " \n", " \n", @@ -1194,7 +1196,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "\u001b[31mUnexpected error: path /private/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmpyz7hj_pg/invalid_image_path.png does not exists!\u001b[0m\n" + "\u001b[31mUnexpected error: path /private/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmp2o74__rq/invalid_image_path.png does not exists!\u001b[0m\n" ] }, { @@ -1228,7 +1230,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "/private/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmpp28ajar0/valid_image_path.png\n" + "/private/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmpg8lh6g5l/valid_image_path.png\n" ] } ], @@ -1264,7 +1266,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "/private/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmpxmvj_xds/valid_image_path.png\n" + "/private/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmpbyzdgiym/valid_image_path.png\n" ] } ], @@ -1304,7 +1306,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "/private/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmp9cv56lho/mkdocs/docs_overrides/images/default_social_logo.png\n" + "/private/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmpzozmfb7a/mkdocs/docs_overrides/images/default_social_logo.png\n" ] } ], @@ -1369,7 +1371,7 @@ "output_type": "stream", "text": [ "************************************************************************************************************************\n", - "Social share image generated and saved at: '/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmpnoir9d8x/mkdocs/docs_overrides/images/social_image.png'\n", + "Social share image generated and saved at: '/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmp1mgox1ev/mkdocs/docs_overrides/images/social_image.png'\n", "overrides/images/social_image.png\n", "{% extends \"base.html\" %}\n", "\n", @@ -1380,7 +1382,8 @@ " {% elif page and page.title and not page.is_homepage %}\n", " {% set title = title ~ \" - \" ~ page.title | striptags %}\n", " {% endif %}\n", - " {% set image_url = page.canonical_url ~ \"\" ~ config.extra.social_image %}\n", + " {% set trailing_slash = \"\" if config.site_url.endswith(\"/\") else \"/\" %}\n", + " {% set image_url = config.site_url ~ (\"\" if config.site_url.endswith(\"/\") else \"/\") ~ config.extra.social_image %}\n", " \n", " \n", " \n", @@ -1406,7 +1409,7 @@ "\n", "\n", "************************************************************************************************************************\n", - "Social share image generated and saved at: '/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmpc7rob39j/mkdocs/docs_overrides/images/social_image.png'\n", + "Social share image generated and saved at: '/var/folders/6n/3rjds7v52cd83wqkd565db0h0000gn/T/tmpuomv88ni/mkdocs/docs_overrides/images/social_image.png'\n", "https://github.com/airtai/nbdev-mkdocs/raw/main/mkdocs/docs_overrides/images/default_social_logo.png\n", "{% extends \"base.html\" %}\n", "\n", @@ -1417,6 +1420,7 @@ " {% elif page and page.title and not page.is_homepage %}\n", " {% set title = title ~ \" - \" ~ page.title | striptags %}\n", " {% endif %}\n", + " {% set trailing_slash = \"\" if config.site_url.endswith(\"/\") else \"/\" %}\n", " {% set image_url = config.extra.social_image %}\n", " \n", " \n", @@ -1501,7 +1505,7 @@ "\n", " if generator == \"file\":\n", " assert (\n", - " '{% set image_url = page.canonical_url ~ \"\" ~ config.extra.social_image %}'\n", + " '{% set image_url = config.site_url ~ (\"\" if config.site_url.endswith(\"/\") else \"/\") ~ config.extra.social_image %}'\n", " in actual\n", " ), actual\n", " elif generator == \"dall_e\":\n", diff --git a/nbs/guides/Advanced_Customization_Options.ipynb b/nbs/guides/Advanced_Customization_Options.ipynb index 841ba0e0..43198b70 100644 --- a/nbs/guides/Advanced_Customization_Options.ipynb +++ b/nbs/guides/Advanced_Customization_Options.ipynb @@ -68,7 +68,7 @@ "source": [ "## Using Mathematical formulas\n", "\n", - "[MathJax](https://www.mathjax.org/) is being already set up as described [here](https://squidfunk.github.io/mkdocs-material/reference/mathjax/#mkdocsyml).\n", + "[MathJax](https://www.mathjax.org/) is being already set up as described [here](https://squidfunk.github.io/mkdocs-material/reference/math/#mathjax).\n", "\n", "### Using the block syntax\n", "Blocks must be enclosed in `$$...$$` or `\\[...\\]` on separate lines:\n", diff --git a/nbs/index.ipynb b/nbs/index.ipynb index 593430d4..83e05788 100644 --- a/nbs/index.ipynb +++ b/nbs/index.ipynb @@ -209,7 +209,7 @@ "source": [ "The following quick start guide will walk you through installing and configuring nbdev-mkdocs for an existing nbdev project. It also assumes you've already initialized your project with nbdev and installed all of the required libraries.\n", "\n", - "For detailed installation instructions and configuration options, please see the User Guide.\n", + "For detailed installation instructions and configuration options, please see the User Guide.\n", "\n", "### Install\n", "\n", diff --git a/settings.ini b/settings.ini index 02b1a4b1..980ff5b0 100644 --- a/settings.ini +++ b/settings.ini @@ -5,8 +5,8 @@ ### Python library ### repo = nbdev-mkdocs lib_name = %(repo)s -version = 0.5.2rc0 -min_python = 3.7 +version = 0.6.0rc0 +min_python = 3.8 license = apache2 ### nbdev ###