squidfunk / mkdocs-material

Documentation that simply works
https://squidfunk.github.io/mkdocs-material/
MIT License
20.83k stars 3.53k forks source link

blog plugin incompatible with mkdocs-bibtex #4531

Closed ZhiyuanChen closed 2 years ago

ZhiyuanChen commented 2 years ago

Contribution guidelines

I've found a bug and checked that ...

Description

mkdocs-bibtex inline citation in summary breaks blog plugin

Expected behaviour

Works

Actual behaviour

ERROR - Blog post 'blog/posts/example.md' has no date set.

Steps to reproduce

---
title: Learning Transferable Visual Models From Natural Language Supervision
summary: [CLIP](https://arxiv.org/abs/2103.00020)[@CLIP]
date: 2021-02-26
---

Package versions

(Though the output of pip show mkdocs-material | grep -E ^Version is as follows:

grep: docs copy: Is a directory
mkdocs.yml:      bib_file: "docs/references.bib"
grep: overrides: Is a directory
requirments.txt:mkdocs
requirments.txt:mkdocs-material
requirments.txt:mkdocs-awesome-pages-plugin
requirments.txt:mkdocs-bibtex
requirments.txt:mkdocs-git-revision-date-localized-plugin
requirments.txt:mkdocs-git-committers-plugin
requirments.txt:mkdocs-rss-plugin
requirments.txt:mkdocs-static-i18n
requirments.txt:mkdocstrings
requirments.txt:mkdocstrings[python]
ERROR: Pipe to stdout was broken
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
BrokenPipeError: [Errno 32] Broken pipe

Configuration

nav:
  - index.md

theme:
  name: material
  custom_dir: overrides
  language: 'zh'
  palette:
    - media: "(prefers-color-scheme: dark)"
      scheme: slate
      primary: blue grey
      accent: teal
      toggle:
        icon: material/brightness-4
        name: Switch to light mode
    - media: "(prefers-color-scheme: light)"
      scheme: default
      primary: blue grey
      accent: teal
      toggle:
        icon: material/brightness-7
        name: Switch to dark mode
  logo: 'assets/images/logo.png'
  favicon: 'assets/images/logo.ico'
  features:
    - announce.dismiss
    - content.code.annotate
    - content.tabs.link
    - content.tooltips
    - header.autohide
    - navigation.expand
    - navigation.indexes
    - navigation.instant
    - navigation.prune
    - navigation.sections
    - navigation.tabs
    - navigation.tabs.sticky
    - navigation.top
    - navigation.tracking
    - search.highlight
    - search.share
    - search.suggest
    - toc.follow
    - toc.integrate
  font: false

extra_javascript: 
  - javascripts/mathjax.js
  - https://polyfill.io/v3/polyfill.min.js?features=es6
  - https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
  - javascripts/shortcuts.js

markdown_extensions:
  - abbr
  - admonition
  - attr_list
  - def_list
  - footnotes
  - md_in_html
  - mdx_math
  - meta
  - pymdownx.arithmatex:
      generic: true
  - pymdownx.betterem:
      smart_enable: all
  - pymdownx.caret
  - pymdownx.critic
  - pymdownx.details
  - pymdownx.emoji:
      emoji_index: !!python/name:materialx.emoji.twemoji
      emoji_generator: !!python/name:materialx.emoji.to_svg
  - pymdownx.highlight:
      anchor_linenums: true
      auto_title: true
      linenums: true
  - pymdownx.inlinehilite
  - pymdownx.keys
  - pymdownx.magiclink
  - pymdownx.mark
  - pymdownx.smartsymbols
  - pymdownx.snippets
  - pymdownx.superfences:
      custom_fences:
        - name: mermaid
          class: mermaid
          format: !!python/name:pymdownx.superfences.fence_code_format
  - pymdownx.tabbed:
      alternate_style: true
  - pymdownx.tasklist:
      custom_checkbox: true
  - pymdownx.tilde
  - smarty
  - tables
  - toc:
      permalink: true

plugins:
  - meta
  - blog:
      blog_dir: .
      post_date_format: full
      post_url_format: "{slug}"
  - bibtex:
      bib_file: "docs/references.bib"
      csl_file: "https://raw.githubusercontent.com/citation-style-language/styles/master/ieee.csl"
      cite_inline: true
  # - git-revision-date-localized:
  #     type: iso_datetime
  # - git-committers
  - privacy:
      externals_exclude:
        - cdn.jsdelivr.net/npm/mathjax@3/*
        - giscus.app/*
        - github-readme-stats.vercel.app/*
  - rss:
      match_path: .* 
      date_from_meta:
        as_creation: date
      categories:
        - categories
        - tags
  - search:
      separator: '[\s\u200b\-]'
  - tags

System information

github codespaces

squidfunk commented 2 years ago

Thanks for reporting. I suspect that this is not an issue with the blog plugin, but a problem with the YAML front matter parser breaking at summary: [CLIP](https://arxiv.org/abs/2103.00020)[@CLIP] throwing everything away that follows it. I'll look into it, but if this is the case, it's a MkDocs, not Material for MkDocs issue.

squidfunk commented 2 years ago

I've investigated – the blog plugin get's invalid metadata due to the value of the summary field, which means that mkdocs-bibtex seems to corrupt the front matter. Please report this to the authors of the mkdocs-bibtex plugin.