Skip to content

BREAK: Modified `bookdown.json` schema

Pre-release
Pre-release
Compare
Choose a tag to compare
@pmjones pmjones released this 05 Mar 15:58

In this release, the "content" element changes from an object to an array. The array elements are themselves objects in the format {"name": "origin"}. For example:

{
    "title": "My Book",
    "content": [
        {"page1": "page1.md"},
        {"page2": "whatever.md"},
        {"section1": "section1/bookdown.md"},
        {"section2": "http://example.com/remote/bookdown.json"}
    ]
}

This release also allows any "content" array element to be an origin string instead of an object {"name": "origin"}. This will cause Bookdown to auto-determine the "name" from the origin string:

  • If the origin string ends in bookdown.json, the "name" is basename(dirname($origin))
  • Otherwise, the "name" is basename($origin), minus any filename extension on the origin

The following is equivalent to the above:

{
    "title": "My Book",
    "content": [
        "page1.md",
        {"page2": "whatever.md"},
        "section1/bookdown.json",
        {"section2": "http://example.com/remote/bookdown.json"}
    ]
}

The easiest way to transition from the previous bookdown.json schema is to:

  1. Change the "content" object braces to array brackets, and
  2. Wrap each "content" item in object braces.

Please create an issue if you have problems.