Giter Site home page Giter Site logo

obsidianpublisher / template-overrides Goto Github PK

View Code? Open in Web Editor NEW
27.0 4.0 1.0 184 KB

Please, follow this repo to get the update for template!

License: GNU General Public License v3.0

Python 40.79% HTML 59.21%
sync auto-update obsidian obsidiangithubpublisher github publisher

template-overrides's People

Contributors

lisandra-dev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

leftomelas

template-overrides's Issues

Error about the workflow "Get latest release from template"

Firstly,when I used the template-gh-pages, everything works. After that i run the workflow "Get latest release from template", then I can't finish the workflow "Publish". I get this

Run venv/bin/python3 -m mkdocs build
INFO    -  "highlightjs" feature is disabled in your plugin configuration.
INFO    -  "mermaid2" feature is disabled in your plugin configuration.
INFO    -  Cleaning site directory
INFO    -  Building documentation to directory: /home/runner/work/skq1998.github.io/skq1998.github.io/site
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/runner/work/skq1998.github.io/skq1998.github.io/venv/lib/python3.11/site-packages/mkdocs/__main__.py", line 361, in <module>
    cli()
  File "/home/runner/work/skq1998.github.io/skq1998.github.io/venv/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/skq1998.github.io/skq1998.github.io/venv/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/runner/work/skq1998.github.io/skq1998.github.io/venv/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/skq1998.github.io/skq1998.github.io/venv/lib/python3.11/site-packages/click/core.py", line [14](https://github.com/skq1998/skq1998.github.io/actions/runs/5776462085/job/15655623239#step:7:15)34, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/skq1998.github.io/skq1998.github.io/venv/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/skq1998.github.io/skq1998.github.io/venv/lib/python3.11/site-packages/mkdocs/__main__.py", line 286, in build_command
    build.build(cfg, dirty=not clean)
  File "/home/runner/work/skq1998.github.io/skq1998.github.io/venv/lib/python3.11/site-packages/mkdocs/commands/build.py", line 304, in build
    files = config.plugins.on_files(files, config=config)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/skq1998.github.io/skq1998.github.io/venv/lib/python3.11/site-packages/mkdocs/plugins.py", line 533, in on_files
    return self.run_event('files', files, config=config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/skq1998.github.io/skq1998.github.io/venv/lib/python3.11/site-packages/mkdocs/plugins.py", line 507, in run_event
    result = method(item, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/skq1998.github.io/skq1998.github.io/overrides/hooks/on_files.py", line 20, in on_files
    list_existing_pages(config, files)
  File "/home/runner/work/skq1998.github.io/skq1998.github.io/overrides/hooks/on_files.py", line [15](https://github.com/skq1998/skq1998.github.io/actions/runs/5776462085/job/15655623239#step:7:16), in list_existing_pages
    json.dump(pages, f, default=lambda o: o.__dict__, indent=4)
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/json/__init__.py", line [17](https://github.com/skq1998/skq1998.github.io/actions/runs/5776462085/job/15655623239#step:7:18)9, in dump
    for chunk in iterable:
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/json/encoder.py", line 430, in _iterencode
    yield from _iterencode_list(o, _current_indent_level)
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/json/encoder.py", line 326, in _iterencode_list
    yield from chunks
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/json/encoder.py", line 440, in _iterencode
    yield from _iterencode(o, _current_indent_level)
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/json/encoder.py", line 432, in _iterencode
    yield from _iterencode_dict(o, _current_indent_level)
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/json/encoder.py", line 406, in _iterencode_dict
    yield from chunks
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/json/encoder.py", line 440, in _iterencode
    yield from _iterencode(o, _current_indent_level)
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/json/encoder.py", line 432, in _iterencode
    yield from _iterencode_dict(o, _current_indent_level)
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/json/encoder.py", line 406, in _iterencode_dict
    yield from chunks
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/json/encoder.py", line 440, in _iterencode
    yield from _iterencode(o, _current_indent_level)
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/json/encoder.py", line 439, in _iterencode
    o = _default(o)
        ^^^^^^^^^^^
  File "/home/runner/work/skq[19](https://github.com/skq1998/skq1998.github.io/actions/runs/5776462085/job/15655623239#step:7:20)98.github.io/skq1998.github.io/overrides/hooks/on_files.py", line 15, in <lambda>
    json.dump(pages, f, default=lambda o: o.__dict__, indent=4)
                                          ^^^^^^^^^^
AttributeError: 'mappingproxy' object has no attribute '__dict__'. Did you mean: '__dir__'?
Error: Process completed with exit code 1.

I found that update.yml is used to download latest releas of sync-template.

jobs:
  get-env:
    runs-on: ubuntu-latest
    outputs:
      update: ${{ steps.version.outputs.update }}
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: get template version
        uses: robinraju/release-downloader@main
        with:
          latest: true
          repository: "ObsidianPublisher/sync_template"
          fileName: "update.txt"
      - name: compare version.txt and update.txt
        id: version
        run: |
          if [ ! -f version.txt ]; then
            mv update.txt version.txt
            echo "update=true" > $GITHUB_OUTPUT
          elif [[ "$(cat version.txt)" < "$(cat update.txt)" ]]; then
            echo "update=true" > $GITHUB_OUTPUT
            rm version.txt
            mv update.txt version.txt
          else
            echo "update=false" > $GITHUB_OUTPUT
            rm update.txt
          fi

And I check the code in sync-template/v2.3.3, I found the same thing with the error content

import json
import posixpath
import os
from mkdocs.structure.files import Files
from mkdocs.config.defaults import MkDocsConfig
 
def list_existing_pages(config: MkDocsConfig, files: Files):
    pages = []
    output_dir = config['site_dir']
    for file in files:
        if file.is_documentation_page() or file.is_media_file():
            pages.append(file)
    
    with open(posixpath.join(output_dir, 'search', 'all_files.json'), 'w') as f:
        json.dump(pages, f, default=lambda o: o.__dict__, indent=4)
 
def on_files(files: Files, config: MkDocsConfig):
    if not (posixpath.exists(posixpath.join(config['site_dir'], 'search'))):
        os.makedirs(posixpath.join(config['site_dir'], 'search'))
    list_existing_pages(config, files)
    return files

Maybe you haven't released sync-template/v2.3.4 sucessfully.

[Bug]: Internal links grayed out / displayed as class=" not found" on GH Pages

Material General discussion

Error

GET
https://audiolotus.github.io/FlwrzD2/assets/meta/favicons.png
[HTTP/2 404  36ms]

GET
[https://audiolotus.github.io/assets/img/Wishing%20Wall.jpeg](https://audiolotus.github.io/assets/img/Wishing%2520Wall.jpeg)
[HTTP/2 404  38ms]

Empty string passed to getElementById(). [0 - Intro to Last Wish:601:29](https://audiolotus.github.io/FlwrzD2/Raids/Last%20Wish/0%20-%20Intro%20to%20Last%20Wish/)
GET
https://audiolotus.github.io/FlwrzD2/assets/meta/favicons.png
[HTTP/2 404  42ms]

GET
[https://audiolotus.github.io/assets/img/Wishing%20Wall.jpeg](https://audiolotus.github.io/assets/img/Wishing%2520Wall.jpeg)
[HTTP/2 404  44ms]

Source map error: Error: NetworkError when attempting to fetch resource.
Resource URL: https://unpkg.com/@popperjs/core@2/dist/umd/popper.min.js
Source Map URL: popper.min.js.map

Source map error: Error: NetworkError when attempting to fetch resource.
Resource URL: https://unpkg.com/tippy.js@6/dist/tippy-bundle.umd.js
Source Map URL: tippy-bundle.umd.js.map

XHRGET
[https://audiolotus.github.io/FlwrzD2/Raids/0 - Intro to Last Wish.mdencounters](https://audiolotus.github.io/FlwrzD2/Raids/0%20-%20Intro%20to%20Last%20Wish.mdencounters)
[HTTP/2 404  56ms]

TypeError: e.split is not a function
    calculateHeight https://cdn.jsdelivr.net/gh/ObsidianPublisher/assets@main/dist/javascript.js:1
    onShow https://cdn.jsdelivr.net/gh/ObsidianPublisher/assets@main/dist/javascript.js:1
    promise callback*onShow https://cdn.jsdelivr.net/gh/ObsidianPublisher/assets@main/dist/javascript.js:1
    show https://unpkg.com/tippy.js@6/dist/tippy-bundle.umd.js:1406
    scheduleShow https://unpkg.com/tippy.js@6/dist/tippy-bundle.umd.js:1260
    onTrigger https://unpkg.com/tippy.js@6/dist/tippy-bundle.umd.js:1034
    on https://unpkg.com/tippy.js@6/dist/tippy-bundle.umd.js:952
    on https://unpkg.com/tippy.js@6/dist/tippy-bundle.umd.js:951
    addListeners https://unpkg.com/tippy.js@6/dist/tippy-bundle.umd.js:977
    addListeners https://unpkg.com/tippy.js@6/dist/tippy-bundle.umd.js:972
    setProps https://unpkg.com/tippy.js@6/dist/tippy-bundle.umd.js:1335
    setInternalProps https://unpkg.com/tippy.js@6/dist/tippy-bundle.umd.js:2345
    addModifier https://unpkg.com/tippy.js@6/dist/tippy-bundle.umd.js:2351
    invokeHook https://unpkg.com/tippy.js@6/dist/tippy-bundle.umd.js:780
    invokeHook https://unpkg.com/tippy.js@6/dist/tippy-bundle.umd.js:778
    createTippy https://unpkg.com/tippy.js@6/dist/tippy-bundle.umd.js:702
    instances https://unpkg.com/tippy.js@6/dist/tippy-bundle.umd.js:1621
    tippy https://unpkg.com/tippy.js@6/dist/tippy-bundle.umd.js:1620
    <anonymous> https://cdn.jsdelivr.net/gh/ObsidianPublisher/assets@main/dist/javascript.js:1
[javascript.js:1:7261](https://cdn.jsdelivr.net/gh/ObsidianPublisher/assets@main/dist/javascript.js)
GET
https://audiolotus.github.io/FlwrzD2/assets/meta/favicons.png
[HTTP/2 404  0ms]

Source map error: Error: NetworkError when attempting to fetch resource.
Resource URL: https://unpkg.com/tippy.js@6/dist/tippy-bundle.umd.js
Source Map URL: tippy-bundle.umd.js.map

Bug description

Links are unable to be clicked on the published GH Page.

Steps to reproduce

Initial Steps

  1. Use wikilinks in file with Obsidian option for relative path to file turned on
  2. Within the GH Publisher plugin, turn on Internal links and Wikilinks to MD Links
  3. Publish note

When using filenames with a "." this initially cause additional entities to appear in the html such as %2520, which caused errors. The issue happened after changing the links to pure markdown []() , as well as after changing the filenames to include "-" instead.

Expected behavior

The links from various pages should send me to the proper page. I'll use an example of just one page to make things easier though.

Here's one of the pages with a link that doesn't work and what it looks like HTML wise in the inspector:

image

Here is the page that link is supposed to go to:

https://audiolotus.github.io/FlwrzD2/Raids/Last%20Wish/Morgeth/

Screenshots

image

In case it's relevant:
image

Additional context

This is in reference to the bug I initially filed over in the plugin repo: ObsidianPublisher/obsidian-github-publisher#304 in case it helps provide any additional help.

The errors listed above are from the inspector in FireFox when viewing this specific page


I've tried naming the files different things with no success.

For example This page has been called:

3. Morgeth, the Spirekeeper
3 - Morgeth, the Spirekeeper
3 - Morgeth the Spirekeeper
and now, just "Morgeth"

Changing the naming to remove spaces / punctuation did not work in any form. I will note that in the GH Repo itself, the internal links work.


Here is a link to the repo:
https://github.com/AudioLotus/FlwrzD2

To the main site itself:
https://audiolotus.github.io/FlwrzD2

(Pardon the mess, just wanted to get things set up before I work on formatting and customizing haha)

Thanks again for everything!

Requirements

mkdocs==1.5.3
mkdocs-material==9.5.7
mkdocs-ezlinked-plugin==0.3.3
mkdocs-awesome-pages-plugin==2.9.2
mdx_breakless_lists==1.0.1
mkdocs-embed-file-plugins==2.0.9
mkdocs_custom_fences==0.1.2
mkdocs-git-revision-date-localized-plugin==1.2.4
mkdocs-encryptcontent-plugin==3.0.3
mkdocs-callouts==1.10.0
mkdocs-custom-tags-attributes==0.3.3
mkdocs-meta-descriptions-plugin==3.0.0
mkdocs-glightbox==0.3.7
obsidiantools==0.10.0
pyvis==0.3.2
cairosvg==2.7.1
pillow==10.2.0

Mkdocs.yml

site_name: MrFlwrz Destiny 2 Guides # Change this to your site name
site_description: Sherpa advice and guides for activities!
site_url: https://audiolotus.github.io/FlwrzD2 # Change this to your site URL
site_author: Flowers

theme:
    name: 'material'
    logo: assets/meta/favicons.png
    favicon: assets/meta/favicons.png
    custom_dir: overrides
    font:
        text: Ubuntu
        code: Ubuntu Mono
    language: en
    palette:

    # Light mode
    - media: "(prefers-color-scheme: light)"
      scheme: default
      primary: teal
      accent: light blue
      toggle:
        icon: material/toggle-switch-off-outline
        name: Switch to dark mode

    # Dark mode
    - media: "(prefers-color-scheme: dark)"
      scheme: slate
      primary: blue
      accent: indigo
      toggle:
        icon: material/toggle-switch
        name: Switch to light mode
        
    features:
        - navigation.indexes
        - navigation.top
        - navigation.tabs
        - navigation.tabs.sticky
        - navigation.expand

# Extensions
markdown_extensions:
  - footnotes
  - nl2br
  - attr_list
  - sane_lists
  - meta
  - smarty
  - tables
  - mdx_breakless_lists
  - def_list
  - pymdownx.arithmatex:
      generic: true
  - pymdownx.details
  - pymdownx.magiclink
  - pymdownx.critic
  - pymdownx.caret
  - pymdownx.keys
  - pymdownx.mark
  - pymdownx.tilde
  - pymdownx.highlight:
      use_pygments: true
      anchor_linenums: true
  - pymdownx.tasklist:
       custom_checkbox: true
  - pymdownx.emoji:
      emoji_index: !!python/name:material.extensions.emoji.twemoji
      emoji_generator: !!python/name:material.extensions.emoji.to_svg
  - admonition
  - toc:
      permalink: true
  - pymdownx.inlinehilite
  - pymdownx.snippets
  - pymdownx.superfences:
      custom_fences:
        - name: mermaid
          class: mermaid
          format: !!python/name:pymdownx.superfences.fence_code_format
plugins:
  - search
  - meta-descriptions
  - ezlinks:
        wikilinks: true
  - awesome-pages
  - embed_file:
      callouts: true
      custom-attributes: 'assets/css/custom_attributes.css'
  - custom-attributes:
      file: 'assets/css/custom_attributes.css'
  - encryptcontent:
      title_prefix: '๐Ÿ”'
      summary: 'Private page'
      placeholder: 'Password'
      decryption_failure_message: 'Invalid password'
      encryption_info_message: "You don't have access to this page."
      search_index: 'encrypted'
      password_button: True
      password_button_text: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" height="1em" width="1em"><!--! Font Awesome Pro 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M416 32h-64c-17.67 0-32 14.33-32 32s14.33 32 32 32h64c17.67 0 32 14.33 32 32v256c0 17.67-14.33 32-32 32h-64c-17.67 0-32 14.33-32 32s14.33 32 32 32h64c53.02 0 96-42.98 96-96V128C512 74.98 469 32 416 32zM342.6 233.4l-128-128c-12.51-12.51-32.76-12.49-45.25 0c-12.5 12.5-12.5 32.75 0 45.25L242.8 224H32C14.31 224 0 238.3 0 256s14.31 32 32 32h210.8l-73.38 73.38c-12.5 12.5-12.5 32.75 0 45.25s32.75 12.5 45.25 0l128-128C355.1 266.1 355.1 245.9 342.6 233.4z"/></svg>'
  - callouts
  - glightbox
hooks:
  - overrides/hooks/on_page_markdown.py
  - overrides/hooks/on_env.py
  - overrides/hooks/on_files.py
extra_javascript:
  - https://cdn.jsdelivr.net/gh/ObsidianPublisher/assets@main/dist/javascript.js
  - https://polyfill.io/v3/polyfill.min.js?features=es6
  - https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
extra_css:
    - https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css
    - https://cdn.jsdelivr.net/gh/ObsidianPublisher/assets@main/dist/styles.css
    - assets/css/admonition.css
    - assets/css/custom_attributes.css
    - assets/css/customization.css
extra:
  SEO: assets/meta/SEO.png
  comments: False #disable comments globally
  generate_graph: false #generate the graph of the site
  attachments: 'assets/img' #path to the folder where the attachments are stored
  no-auto-h1: False #disable the automatic generation of h1 if no h1 is found
  
  hooks:
    strip_comments: true
    fix_heading: true

Clarity around auto-opened PR ("version.txt")

PR version 3 0 3

Hi, I've been playing with the excellent ObsidianPublisher/template-gh-pages workflow. Yesterday my forked repo received an automated pull-request for a new version bump (3.0.3). (Repo is private so I can't link to the PR; screenshot above)

Because the automated PR did not contain a changelog link or release notes explaining what this version bump entailed, I spent time poking around in the web of connected repos trying to understand what the effect of merging this PR would be.

My hypotheses about the mysterious version.txt, in order, discarded:

  • first I thought it corresponded to a Python version update, but that seems not to be the case
  • then I assumed it was a version for some required python runtime
    • for the github workflow? Not sure how to check this.
  • then I guessed maybe it was the mkdocs version number, but I ruled that out as well
  • now my assumption is that maybe this refers to a change in the templated workflow actions? is this right?

Can you please clarify what merging this automated version bump PR will actually change?

Update: I found this corresponding 3.0.3 release in template-main that updates find_unused_media.py. ๐ŸŽ‰

So I think I answered my own question. Maybe it would be ideal to include a link to the release changelog in future automated PR templates if possible, to save users the time of trying to understand what merging a mysterious, un-attributed PR would do :)

Thanks in advance.

Repos I bumped around in, exploring:

[Bug]: Broken links, made with DataviewJS

Material General discussion

Error

There's no error

Bug description

I'm trying to make a wiki-style infobox which autogenerates people data from properties, such as birth, date, filial relations, etc. The problems I'm experiencing is, whenever I publish a page with links made using dataviewjs, that either contains spaces or is direct relation to a page, then the link is broken on the published page. It seems like the links are not referenced properly in the output, and just appends to the current url.

Steps to reproduce

  1. Create 3 note "Characters/John Doe", "Characters/Jane Doe" and "Characters/Janie"
  2. Create 1 note "Dates/1960"
  3. Paste the following into John Doe
---
Birth: "[[1960]]"
Siblings:
  - "[[Jane Doe]]"
  - "[[Janie]]"
---
#### These links work as intended
- `$= dv.fileLink(dv.page(this.current().Birth).file.name)`
- `$= dv.fileLink("1960")`
- `$= dv.current().Siblings[1]`

#### These links appends to the url, and results in a 404
- `$= dv.current().Birth` 
- `$= dv.current().Siblings[0]`
  1. Publish notes

Expected behavior

All the links should be static url's, instead of being relative url's.

Screenshots

No response

Additional context

No response

Requirements

mkdocs==1.5.3
mkdocs-material==9.5.8
mkdocs-ezlinked-plugin==0.3.3
mkdocs-awesome-pages-plugin==2.9.2
mdx_breakless_lists==1.0.1
mkdocs-embed-file-plugins==2.0.9
mkdocs_custom_fences==0.1.2
mkdocs-git-revision-date-localized-plugin==1.2.4
mkdocs-encryptcontent-plugin==3.0.3
mkdocs-callouts==1.10.0
mkdocs-custom-tags-attributes==0.3.3
mkdocs-meta-descriptions-plugin==3.0.0
mkdocs-glightbox==0.3.7
obsidiantools==0.10.0
pyvis==0.3.2
cairosvg==2.7.1
pillow==10.2.0

Mkdocs.yml

site_name: Pendragon Notes # Change this to your site name
site_description: Obsdian notes
site_url: http://skroink.github.io/pendragon-notes # Change this to your site URL
site_author: skroink

theme:
    name: 'material'
    logo: assets/meta/favicons.png
    favicon: assets/meta/favicons.png
    custom_dir: overrides
    font:
        text: Ubuntu
        code: Ubuntu Mono
    language: en
    palette:

    # Light mode
    - media: "(prefers-color-scheme: light)"
      scheme: default
      primary: teal
      accent: light blue
      toggle:
        icon: material/toggle-switch-off-outline
        name: Switch to dark mode

    # Dark mode
    - media: "(prefers-color-scheme: dark)"
      scheme: slate
      primary: blue
      accent: indigo
      toggle:
        icon: material/toggle-switch
        name: Switch to light mode
    features:
        - navigation.indexes
        - navigation.top
        - navigation.tabs
        - navigation.tabs.sticky
        - navigation.expand
        - search.suggest
        - search.highlight

# Extensions
markdown_extensions:
  - footnotes
  - nl2br
  - attr_list
  - sane_lists
  - meta
  - smarty
  - tables
  - mdx_breakless_lists
  - def_list
  - pymdownx.arithmatex:
      generic: true
  - pymdownx.details
  - pymdownx.magiclink
  - pymdownx.critic
  - pymdownx.caret
  - pymdownx.keys
  - pymdownx.mark
  - pymdownx.tilde
  - pymdownx.highlight:
      use_pygments: true
      anchor_linenums: true
  - pymdownx.tasklist:
       custom_checkbox: true
  - pymdownx.emoji:
      emoji_index: !!python/name:material.extensions.emoji.twemoji
      emoji_generator: !!python/name:material.extensions.emoji.to_svg
  - admonition
  - toc:
      permalink: true
  - pymdownx.inlinehilite
  - pymdownx.snippets
  - pymdownx.superfences:
      custom_fences:
        - name: mermaid
          class: mermaid
          format: !!python/name:pymdownx.superfences.fence_code_format
plugins:
  - search
  - meta-descriptions
  - git-revision-date-localized:
      type: date
      fallback_to_build_date: true
      locale: en
      custom_format: "%A %d %B %Y"
      enable_creation_date: true
  - ezlinks:
        wikilinks: true
  - awesome-pages
  - embed_file:
      callouts: true
      custom-attributes: 'assets/css/custom_attributes.css'
  - custom-attributes:
      file: 'assets/css/custom_attributes.css'
  - tags:
      tags_file: tags.md
  - encryptcontent:
      title_prefix: '๐Ÿ”'
      summary: 'Private page'
      placeholder: 'Password'
      decryption_failure_message: 'Invalid password'
      encryption_info_message: "You don't have access to this page."
      search_index: 'encrypted'
      password_button: True
      password_button_text: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" height="1em" width="1em"><!--! Font Awesome Pro 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M416 32h-64c-17.67 0-32 14.33-32 32s14.33 32 32 32h64c17.67 0 32 14.33 32 32v256c0 17.67-14.33 32-32 32h-64c-17.67 0-32 14.33-32 32s14.33 32 32 32h64c53.02 0 96-42.98 96-96V128C512 74.98 469 32 416 32zM342.6 233.4l-128-128c-12.51-12.51-32.76-12.49-45.25 0c-12.5 12.5-12.5 32.75 0 45.25L242.8 224H32C14.31 224 0 238.3 0 256s14.31 32 32 32h210.8l-73.38 73.38c-12.5 12.5-12.5 32.75 0 45.25s32.75 12.5 45.25 0l128-128C355.1 266.1 355.1 245.9 342.6 233.4z"/></svg>'
  - callouts
  - glightbox
hooks:
  - overrides/hooks/on_page_markdown.py
  - overrides/hooks/on_env.py
  - overrides/hooks/on_files.py
extra_javascript:
  - https://cdn.jsdelivr.net/gh/ObsidianPublisher/assets@main/dist/javascript.js
  - https://polyfill.io/v3/polyfill.min.js?features=es6
  - https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
extra_css:
    - https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css
    - https://cdn.jsdelivr.net/gh/ObsidianPublisher/assets@main/dist/styles.css
    - assets/css/admonition.css
    - assets/css/custom_attributes.css
    - assets/css/customization.css
    - stylesheets/infobox.css
    - stylesheets/tables.css
extra:
  SEO: assets/meta/SEO.png
  comments: False #disable comments globally
  generate_graph: True #generate the graph of the site
  attachments: 'assets/img' #path to the folder where the attachments are stored
  no-auto-h1: False #disable the automatic generation of h1 if no h1 is found
  blog_list:
    pagination: true #enable pagination
    pagination_message: true #display the message "Showing x posts out of y"
    pagination_translation: 'posts in' #message to display before the number of posts ; Add your own translation!
    no_page_found: "No pages found!" #message to display when no pages are found ; Add your own translation!
  hooks:
    strip_comments: true
    fix_heading: true

[Bug]: If there are two blocks of comment, and both of them span multiple lines, then the text in between them is stripped

With this Mkdocs.yml:

site_name: test 
theme:
    name: 'material'
    custom_dir: overrides
hooks:
  - overrides/hooks/on_page_markdown.py
  - overrides/hooks/on_env.py
extra:
  generate_graph: false #generate the graph of the site

And this content:

a
%%b
%%
c
%%
d%%
e

The HTML result will be:

<p>a</p>
<p>e</p>

If one of the comment block doesn't have any newline:

a
%%b%%
c
%%
d%%
e

Then it almost works as expected:

<p>a
c</p>
<p>e</p>

Ideally the result should be:

<p>a</p> 
<p>c</p>
<p>e</p>

I try to add the strip_comments hook but it returns error:

site_name: test
theme:
    name: 'material'
    custom_dir: overrides
hooks:
  - overrides/hooks/on_page_markdown.py
  - overrides/hooks/on_env.py
extra:
  generate_graph: false #generate the graph of the site
  hooks:
    strip_comments: false
ERROR   -  Error reading page 'index.md':
           'fix_heading'
Traceback (most recent call last):
  File "C:\Users\ganuo\AppData\Local\Programs\Python\Python311\Lib\site-packages\mkdocs\livereload\__init__.py", line 190, in _build_loop 
    func()
  File "C:\Users\ganuo\AppData\Local\Programs\Python\Python311\Lib\site-packages\mkdocs\commands\serve.py", line 67, in builder
    build(config, live_server=None if is_clean else server, dirty=is_dirty)
  File "C:\Users\ganuo\AppData\Local\Programs\Python\Python311\Lib\site-packages\mkdocs\commands\build.py", line 322, in build
    _populate_page(file.page, config, files, dirty)
  File "C:\Users\ganuo\AppData\Local\Programs\Python\Python311\Lib\site-packages\mkdocs\commands\build.py", line 171, in _populate_page   
    page.markdown = config.plugins.on_page_markdown(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ganuo\AppData\Local\Programs\Python\Python311\Lib\site-packages\mkdocs\plugins.py", line 575, in on_page_markdown        
    return self.run_event('page_markdown', markdown, page=page, config=config, files=files) 
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
  File "C:\Users\ganuo\AppData\Local\Programs\Python\Python311\Lib\site-packages\mkdocs\plugins.py", line 507, in run_event
    result = method(item, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Programming\Static web\mkdocs\test\ObsidianPulisherTest\overrides\hooks\on_page_markdown.py", line 43, in on_page_markdown     
    if config_hooks['fix_heading']:
       ~~~~~~~~~~~~^^^^^^^^^^^^^^^
KeyError: 'fix_heading'
ERROR   -  [22:11:34] An error happened during
           the rebuild. The server will appear
           stuck until build errors are       
           resolved.

requirements.txt

mkdocs
mkdocs-material
mkdocs-mermaid2-plugin
mkdocs-ezlinked-plugin
mkdocs-awesome-pages-plugin
mdx_breakless_lists
mkdocs-embed-file-plugins
mkdocs_custom_fences
mkdocs-git-revision-date-localized-plugin
mkdocs-encryptcontent-plugin
mkdocs-callouts
mkdocs-custom-tags-attributes
mkdocs-static-i18n
mkdocs-meta-descriptions-plugin
mkdocs-glightbox
mkdocs-minify-plugin
mkdocs-exclude
cairocffi
pillow 
cairosvg

[Bug]: "Dirty" YAML will cause file to be ignored when generating graph

Material General discussion

Error

Front matter not populated for Gastro.md: ParserError(None, None, 'did not find expected <document start>', <yaml._yaml.Mark object at 0x0000014239CCDF30>)

Bug description

A "dirty" YAML will cause the file to be skipped

Steps to reproduce


title: Paramyxoviridae ssRNA- env
updated: 2023-02-01T20:35:07.0000000+01:00
created: 2023-01-11T22:07:12.0000000+01:00

dg-publish: true
sticker: emoji//1f49d

This is an example of a dirty yaml, with extra spaces

Expected behavior

No response

Screenshots

No response

Additional context

No response

Requirements

mkdocs==1.5.3
mkdocs-material==9.5.3
mkdocs-ezlinked-plugin==0.3.3
mkdocs-awesome-pages-plugin==2.9.2
mdx_breakless_lists==1.0.1
mkdocs-embed-file-plugins==2.0.9
mkdocs_custom_fences==0.1.2
mkdocs-git-revision-date-localized-plugin==1.2.2
mkdocs-encryptcontent-plugin==3.0.1
mkdocs-callouts==1.10.0
mkdocs-custom-tags-attributes==0.3.1
mkdocs-static-i18n==1.2.0
mkdocs-meta-descriptions-plugin==3.0.0
mkdocs-glightbox==0.3.6
mkdocs-minify-plugin==0.7.2
mkdocs-exclude==1.0.2

obsidiantools==0.10.0
pyvis==0.3.2

Mkdocs.yml

site_name: My Digital Garden
site_description: WIP
site_url: *redacted* # Change this to your site URL
site_author: Michele

theme:
    name: 'material'
    logo: assets/meta/favicons.png
    favicon: assets/meta/favicons.png
    custom_dir: overrides
    font:
        text: Ubuntu
        code: Ubuntu Mono
    language: IT
    palette:

    # Light mode
    - media: "(prefers-color-scheme: light)"
      scheme: default
      primary: teal
      accent: light blue
      toggle:
        icon: material/toggle-switch-off-outline
        name: Switch to dark mode

    # Dark mode
    - media: "(prefers-color-scheme: dark)"
      scheme: slate
      primary: blue
      accent: indigo
      toggle:
        icon: material/toggle-switch
        name: Switch to light mode
    features:
        - navigation.indexes
        - navigation.top
        - navigation.tabs
        - navigation.tabs.sticky
        - navigation.expand
        - search.suggest
        - search.highlight

# Extensions
markdown_extensions:
  - footnotes
  - nl2br
  - attr_list
  - sane_lists
  - meta
  - smarty
  - tables
  - mdx_breakless_lists
  - def_list
  - pymdownx.arithmatex:
      generic: true
  - pymdownx.details
  - pymdownx.magiclink
  - pymdownx.critic
  - pymdownx.caret
  - pymdownx.keys
  - pymdownx.mark
  - pymdownx.tilde
  - pymdownx.highlight:
      use_pygments: true
      anchor_linenums: true
  - pymdownx.tasklist:
       custom_checkbox: true
  - pymdownx.emoji:
      emoji_index: !!python/name:material.extensions.emoji.twemoji
      emoji_generator: !!python/name:material.extensions.emoji.to_svg
  - admonition
  - toc:
      permalink: true
  - pymdownx.inlinehilite
  - pymdownx.snippets
  - pymdownx.superfences:
      custom_fences:
        - name: mermaid
          class: mermaid
          format: !!python/name:pymdownx.superfences.fence_code_format
plugins:
  - search
  - meta-descriptions
  - git-revision-date-localized:
      type: date
      fallback_to_build_date: true
      locale: IT
      custom_format: "%A %d %B %Y"
      enable_creation_date: true
  - ezlinks:
        wikilinks: true
  - awesome-pages
  - embed_file:
      callouts: true
      custom-attributes: 'assets/css/custom_attributes.css'
  - custom-attributes:
      file: 'assets/css/custom_attributes.css'
  - tags:
      tags_file: tags.md
  - encryptcontent:
      title_prefix: '๐Ÿ”'
      summary: 'Private page'
      placeholder: 'Password'
      decryption_failure_message: 'Invalid password'
      encryption_info_message: "You don't have access to this page."
      search_index: 'encrypted'
      password_button: True
      password_button_text: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" height="1em" width="1em"><!--! Font Awesome Pro 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M416 32h-64c-17.67 0-32 14.33-32 32s14.33 32 32 32h64c17.67 0 32 14.33 32 32v256c0 17.67-14.33 32-32 32h-64c-17.67 0-32 14.33-32 32s14.33 32 32 32h64c53.02 0 96-42.98 96-96V128C512 74.98 469 32 416 32zM342.6 233.4l-128-128c-12.51-12.51-32.76-12.49-45.25 0c-12.5 12.5-12.5 32.75 0 45.25L242.8 224H32C14.31 224 0 238.3 0 256s14.31 32 32 32h210.8l-73.38 73.38c-12.5 12.5-12.5 32.75 0 45.25s32.75 12.5 45.25 0l128-128C355.1 266.1 355.1 245.9 342.6 233.4z"/></svg>'
  - callouts
  - glightbox
hooks:
  - overrides/hooks/on_page_markdown.py
  - overrides/hooks/on_env.py
  - overrides/hooks/on_files.py
extra_javascript:
  - https://cdn.jsdelivr.net/gh/ObsidianPublisher/assets@main/dist/javascript.js
  - https://polyfill.io/v3/polyfill.min.js?features=es6
  - https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
extra_css:
    - https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css
    - https://cdn.jsdelivr.net/gh/ObsidianPublisher/assets@main/dist/styles.css
    - assets/css/admonition.css
    - assets/css/custom_attributes.css
    - assets/css/customization.css
extra:
  SEO: assets/meta/SEO.png
  comments: False #disable comments globally
  generate_graph: true #generate the graph of the site
  attachments: 'assets/img' #path to the folder where the attachments are stored
  no-auto-h1: False #disable the automatic generation of h1 if no h1 is found
  blog_list:
    pagination: true #enable pagination
    pagination_message: true #display the message "Showing x posts out of y"
    pagination_translation: 'posts in' #message to display before the number of posts ; Add your own translation!
    no_page_found: "No pages found!" #message to display when no pages are found ; Add your own translation!
  hooks:
    strip_comments: true
    fix_heading: true

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.