0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

MkDocs encountered as error parsing the configuration file

Last updated at Posted at 2020-11-18

事象 : while parsing a block mapping

  • 環境
    • Windows10 Pro バージョン1909
    • Python 3.8.5
    • MkDocs 1.1.2
    • Material for MkDocs 6.0.2
$ mkdocs build

MkDocs encountered as error parsing the configuration file:
  in "C:\git\reponame\docs\mkdocs.yml", line 18, column 7
expected <block end>, but found '-'
  in "C:\git\reponame\docs\mkdocs.yml", line 19, column 7
mkdocs.yml
# テーマはMaterial for MkDocs
theme: 'material'

nav:
  - 仕様:
    - ツール: 'tool.md'     # << line 18
      - 詳細: 'detail.md'   # << line 19

原因 : 不明

Ymlの書き方に違反しているのか、MkDocsの書き方に違反しているのか・・・Material for MkDocsの書き方に違反しているのか・・・何もかも初心者すぎてわからない。

対応 : ページの配下にページを配置するのをやめる

mkdocs.yml
nav:
  - 仕様:
    - ツール:
      - 仕様: 'tool.md'
      - 詳細: 'detail.md'

事象 : while parsing a block collection

  • 環境
    • Windows10 64bit バージョン1909
    • Python 3.8.5
    • mkdocs, version 1.1.2
$ mkdocs build

MkDocs encountered as error parsing the configuration file: while parsing a block collection
  in "C:\path\to\mkdocs\docs\mkdocs.yml", line 56, column 3
expected <block end>, but found '<block mapping start>'
  in "C:\path\to\mkdocs\docs\mkdocs.yml", line 61, column 7
(mkdocs)
mkdocs.yml
# ...省略...
markdown_extensions:
  - admonition
  - toc:
      permalink: '#'
  - footnotes # 注釈機能
  - pymdownx.highlight # コードシンタックス
      linenums: true

原因 : :がないから

対応 : :をつける

mkdocs.yml
  - pymdownx.highlight: # コードシンタックス
$ mkdocs build
INFO    -  Cleaning site directory
INFO    -  Building documentation to directory: C:\path\to\mkdocs\docs\site
INFO    -  Documentation built in 0.86 seconds
(mkdocs)

事象 : mapping values are not allowed here

  • 環境
    • Windows10 64bit バージョン1909
    • Python 3.8.5
    • mkdocs, version 1.1.2
# ビルドしたらmkdocs.ymlのページ設定で怒られた
$ mkdocs build

MkDocs encountered as error parsing the configuration file: mapping values are not allowed here
  in "C:\path\to\mkdocs\docs\mkdocs.yml", line 16, column 18
(mkdocs)
mkdocs.yml
# ...省略...
nav:
  - はじめに: index.md
  - 概要
    - ぽんすけの旅の日記: ponsuke.md
# ...省略...

原因 : :がないから

エラーのline 16(「ぽんすけの旅の日記」行)の上の行(「概要」行)に:を入れ忘れている

対応 : :をつける

mkdocs.yml
# ...省略...
  - 概要:
    - ぽんすけの旅の日記: ponsuke.md
# ...省略...
$ mkdocs build
INFO    -  Cleaning site directory
INFO    -  Building documentation to directory: C:\path\to\mkdocs\docs\site
INFO    -  Documentation built in 0.15 seconds
(mkdocs)
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?