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

[Discussion] New renderers design #149

Closed
azerupi opened this issue Jun 28, 2016 · 5 comments · Fixed by #507
Closed

[Discussion] New renderers design #149

azerupi opened this issue Jun 28, 2016 · 5 comments · Fixed by #507
Labels
A-Rendering Area: Rendering C-enhancement Category: Enhancement or feature request M-Discussion Meta: Discussion S-Experiment Status: Experiment

Comments

@azerupi
Copy link
Contributor

azerupi commented Jun 28, 2016

The idea, is to separate mdBook into more clearly defined "modules". (not Rust modules)

  • core: The core handles the internal representation. It parses the configuration file and the summary file. It should contain only generic metadata and the structure of the book (see [Discussion] Book representation #146 for more discussion)
  • renderers: Renderers are self contained modules that consume the book as stored in core and render it to one specific target (e.g. html, EPUB, pdf, ...)

Renderers could need additional metadata or offer specific settings that could (and should) not be represented in the core internal representation. For that purpose, the configuration file will allow sub-sections for the renderer specific options. Imagine:

[outputs.html]
path = "book/"
favicon = "src/img/favicon.png"

[outputs.epub]
isbn = "978-0-9999999-9-9"
uuid = "58dce2ac-7aec-45c3-a6de-903a30061545"
version = "1.0"

# ...

Those configuration parameters will be passed down to the renderer, it's his job to actually make sense of those settings.

Essentially MDBook + [outputs.renderer] => Renderer = Output

@azerupi azerupi added this to the Support multiple plug&play renderers milestone Jun 28, 2016
@azerupi azerupi added the M-Discussion Meta: Discussion label Aug 12, 2016
@azerupi azerupi changed the title Allow for multiple renderers [Discussion] New renderers design Aug 12, 2016
@gambhiro
Copy link
Contributor

gambhiro commented Nov 2, 2016

So, different Renderer implementations would be responsible for creating the different output from book.toml + SUMMARY.md + Markdown chapters?

I'm thinking of examples such as,

  • a Renderer that uses an ebook page template and writes a bunch of files to an epub folder
  • another that writes LaTeX chapters (ready to compile) to a latex folder?

@azerupi
Copy link
Contributor Author

azerupi commented Nov 2, 2016

Yes, that's the idea. :)

@azerupi
Copy link
Contributor Author

azerupi commented Nov 2, 2016

@gambhiro I have updated the first post because I noticed that I hadn't written down my thoughts about this part yet. I hope this clarifies some things. :)

This was referenced Nov 2, 2016
@azerupi azerupi removed this from the Support multiple plug&play renderers milestone Nov 3, 2016
@gambhiro
Copy link
Contributor

It seems the key here is to design the data flow between:

  • the summary parser
  • book struct representation
  • renderers processing for different targets (renderer specific structs?)
  • page templates

Remembering that a new renderer will probably want to store more data (in the summary? in a renderer specific file?) -- and that data has to make it to the page templates somehow.

@azerupi azerupi added A-Rendering Area: Rendering S-Experiment Status: Experiment C-enhancement Category: Enhancement or feature request and removed Type: Enhancement labels May 16, 2017
@Michael-F-Bryan
Copy link
Contributor

I believe the majority of this will be implemented in #507, so this issue can be closed when that gets merged. The mechanism used for backends is also documented as part of the user guide (rendered).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Area: Rendering C-enhancement Category: Enhancement or feature request M-Discussion Meta: Discussion S-Experiment Status: Experiment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants