Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow chapters to have an optional TOML header #277

Open
azerupi opened this issue May 16, 2017 · 5 comments
Open

Allow chapters to have an optional TOML header #277

azerupi opened this issue May 16, 2017 · 5 comments
Labels
A-Configuration Area: Configuration A-Internal-representation Area: Internal Representation C-enhancement Category: Enhancement or feature request S-Wishlist Status: Wishlist

Comments

@azerupi
Copy link
Contributor

azerupi commented May 16, 2017

The conclusion of the discussion #176 is to support an optional TOML header in the markdown sources to provide chapter specific information. Chapter specific information that overrides the global configuration for this specific chapter.

A chapter source file could look like the following:

------
author = "John Doe"
title = "A book of little words"
translator = "Jane Doe"
------

# Chapter title

The rest of the file is **normal** markdown

This will probably require some changes to the internal representation.

@azerupi azerupi added A-Configuration Area: Configuration A-Internal-representation Area: Internal Representation S-Wishlist Status: Wishlist C-enhancement Category: Enhancement or feature request labels May 16, 2017
@steveklabnik
Copy link
Member

steveklabnik commented May 16, 2017 via email

@subthedubdub
Copy link

Is it planned for key-value pairs in the TOML header to be available for handlebars templating?

@Michael-F-Bryan
Copy link
Contributor

@mkovarik, we haven't done much towards adding a TOML header just yet, but I'm assuming it would be implemented by adding a metadata field to the Chapter struct which gets filled in during the load_chapter() process. All renderers would then see this field, so it'd be trivial for the HTML renderer to pass the key-value pairs through to the templates.

Did you have a particular use case in mind?

@y9c
Copy link

y9c commented Mar 24, 2020

@Michael-F-Bryan That is useful for migrating from markdown blog into mdbook. Meanwhile metadata for 'create date', 'last modify date' and 'keywords' can be preserved.

@brendanzab
Copy link
Member

This could be really useful for letting us specify HTML metadata. I think this is what docusaurus does, for example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Configuration Area: Configuration A-Internal-representation Area: Internal Representation C-enhancement Category: Enhancement or feature request S-Wishlist Status: Wishlist
Projects
None yet
Development

No branches or pull requests

6 participants