mdBook Template
This repository contains a template for creating books using mdBook.
How to use
To use this template, you must clone this repository using the command:
git clone https://github.com/Rapha-Borges/modelo-mdbook.git
Edit the book.toml
file by entering your book information
[book]
authors = ["AUTHOR"]
title = "TITLE OF YOUR BOOK HERE"
[output.html]
git-repository-url = "https://github.com/{AUTHOR}/{REPOSITORY-NAME}"
edit-url-template = "https://github.com/{AUTHOR}/{REPOSITORY-NAME}/edit/main/pt/{path}"
cname = "CNAME"
Then just follow the development of the book according to the structure of the directories:
└─ pt (Default directory for the PT version)
| |─ book.toml (mdBook configuration file)
| └─ src (Directory used to hold all .md, images and other files that will be referenced throughout the book)
| | └─ BOOKSUMMARY.md (File with the “SUMMARY” text)
| | └─ README.md (File with the “SOBRE” text)
| | └─ SUMMARY.md (Standard mdBook file that generates "CHAPTERS")
| | └─ Capitulo-X (File directory for each chapter)
| └─ theme (Directory with all styling files)
| | └─ index.hbs (HTML configuration file)
| | └─ css (CSS files directory)
| | | └─ style.css (Default CSS style file)
| └─ translation (Directory for translations)
| | └─ en (English files)
| | └─ es (Spanish files)
└─ home (Directory for the home page)
| └─ index.html (Home page main HTML file)
| └─ CSS (Directory for the home page CSS files)
| | └─style.css(Home page main CSS file)
For more information on how each of the files works, just consult the repository of this template, each file will have a description or example.
How to contribute
To contribute to this project, follow these steps:
- Create a fork of the project
- Create a branch for your featurejet (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push the branch (
git push origin feature/AmazingFeature
) - Open a pull request
Add Expandable Menu
Material Design Admonishments TEMPORARILY UNAVAILABLE
Expandable Chapters
Expandable Menu
To add the expandable menu just add the <details>
and <summary>
tags. Placing the title to be displayed inside the <summary>
tag and below the content.
<details>
<summary>{TITLE THAT WILL BE DISPLAYED}</summary>
{CONTENT}
</details>
Example:
CLICK HERE TO OPEN OR CLOSE
This example is using the open
tag so that the menu appears open by default.
TEMPORARILY UNAVAILABLE
Using a processor to add Material Design admonishments.
Example:
``` + admonish + {chosen_format}
{TEXT TO BE DISPLAYED}
```
Reference
For other examples you can consult the official documentation CLICK HERE
Info
A beautifully styled message.
```admonish info
{TEXT TO BE DISPLAYED}
```
Example
My example is the best!
```admonish example
My example is the best!
```
Note
A plain note.
```admonish
A plain note.
```
Warning
```admonish warning title="{TITULO CUSTOMIZADO}"
The following steps can lead to irrecoverable data corruption.
```
The following steps can lead to irrecoverable data corruption.
Success
```admonish success title="{TITULO CUSTOMIZADO}"
This will take a while, go and grab a drink of water.
```
This will take a while, go and grab a drink of water.
Markdown/HTML
You can use markdown and HTML to customize
```admonish tip title="_Referencing_ and <i>dereferencing</i>"
The opposite of *referencing* by using `&` is *dereferencing*, which is
accomplished with the <span style="color: hotpink">dereference operator</span>, `*`.
```
The opposite of *referencing* by using `&` is *dereferencing*, which is
accomplished with the <span style="color: hotpink">dereference operator</span>, `*`.
Bug alert
~~~admonish bug
This syntax won't work in Python 3:
```python
print "Hello, world!"
```
~~~
This syntax won't work in Python 3:
```python
print "Hello, world!"
```
Custom
You can also customize with a CSS file by adding class names
```admonish note class="custom-0 custom-1"
Styled with my custom CSS class.
```
Styled with my custom CSS class.
Which will generate something like this in the HTML, where you can apply the CSS:
<div class="admonition note custom-0 custom-1"
...
</div>
Collapsible
```admonish title="{CUSTOM TITLE}" collapsible=true
{TEXT TO BE DISPLAYED}
```
{TEXT TO BE DISPLAYED}
Invalid blocks
If there is an error in rendering it will be displayed like this
This block will error
Example of expandable chapters
To use the Expandable Chapters function, the SUMMARY.md
file must follow the following format:
- [Example of expandable chapters](Capitulo-3/README.md)
- [Example 1](Capitulo-3/Exemplo-1)
- [Example 2](Capitulo-3/Exemplo-2)
- [Example 3](Capitulo-3/Exemplo-3)