website:
navbar:
background: primary
title: My site
search: true
left:- text: "Home"
file: index.jpynb
- talks.jpynb
- about.jpynb
Custom Page
1. Setup
- Yêu cầu:
nbdev_install_quarto
2. Website
- Quarto Websites là một nền tảng website builder cung cấp các công cụ để tạo và quản lý website một cách dễ dàng và nhanh chóng. Người dùng có thể tạo ra các trang web chuyên nghiệp, thương mại điện tử và blog chỉ trong vài phút mà không cần có kiến thức về lập trình hoặc thiết kế web. Thật may mắn nbdev được xây dựng trên Quarto, do đó chúng ta có thể dễ dàng sử dụng Quarto trên nbdev.
- Một vài option có sẵn từ để custom website navigation như: Hiển thị sidebar theo cấu trúc hierarchy, giao diện điều hướng page, sub-menus …
- Để bắt đầu, bạn hãy mở file config
_quarto.yml
trong foldernbs
để có thể edit.
Favicon
- Hiển thị logo trên tab trình duyệt
website: favicon: logo.png
Separators
- Tách nội dung giữa các sidebar bằng
text: "---"
website:
sidebar:
contents:- section: "Quick start"
contents:- 03_how_to_use_nbdev.ipynb
- 04_directives.ipynb
- 05_create_page.ipynb
- 06_beautiful_page.ipynb
- text: "---"
- section: "Examples"
contents:- 00_card_overview.ipynb
- 01_card.ipynb
- 02_desk.ipynb
- 07_test.ipynb
Dark Mode
- Bật chế độ cho phép chuyển đổi theme: darkly <-> flatly
format:
html:
theme:
light: flatly
dark: darkly
css: styles.css toc: true
- Quarto cung cấp 25 themes có sẵn từ Bootswatch
Tìm hiểu thêm tại Quarto - Website Navigation 😁 💨
3. Custom Content
Trong nbdev, chúng ta có thể sử dụng HTML, CSS, Markdown để decore nội dung của page thông qua Markdown cell
trong notebook.
Formatting Links
- Test 1 –>
[Test 1](07_test.ipynb)
- Test 2 –>
<a style="color: red; text-decoration: none;" href="07_test.ipynb">Test 2</a>
- Test 3 –>
<a class="link-hover" href="07_test.ipynb">Test 3</a>
Note
Test 1 sử dụng markdown.
Test 2 sử dụng html.
Đối với Test 3 hơi phức tạp, liên quan đến cả html và css nên cần phải sử dụng
file `styles.css` trong folder `nbs`. Cụ thể chúng ta sẽ tạo `class="link-hover"` ở
đây, sau đó sẽ set các thuộc tính của class link-hover tại file css như sau:
-hover{
.link#F0266F;
color: -decoration: none;
text
}
-hover:hover{
.link#686868;
color: -decoration: none;
text
}
-hover:active{
.link;
color: black-decoration: none;
text }
Callout Blocks
Để làm được như vậy, sử dụng markdown syntax như sau:
-note}
::: {.callout
Note that there are five types of callouts, including:and `caution`.
`note`, `warning`, `important`, `tip`, :::
-tip}
::: {.calloutis an example of a callout with a title.
This :::
-caution collapse="true"}
::: {.calloutis an example of a 'folded' caution callout that can be expanded by the user. You can
This ="true"` to collapse it by default or `collapse="false"` to make a collapsible
use `collapseis expanded by default.
callout that :::