Adding initial README files.
This commit is contained in:
@ -1,7 +1,72 @@
|
||||
# Tavern
|
||||
# Bard
|
||||
|
||||
A blogging system that will allow you to write your blog in Markdown and then
|
||||
display it in HTML using Dioxus.
|
||||
Bard is the frontend rendering library for the Tavernworks blog system.
|
||||
It provides Dioxus components for rendering blog content that has been compiled
|
||||
into a SQLite database by Loreweaver and parsed by the Tavern engine.
|
||||
|
||||
Bard supports both server-side and client-side rendering and is designed to be
|
||||
integrated into Dioxus applications.
|
||||
|
||||
## Features
|
||||
|
||||
- Dioxus components for routing and rendering blog pages
|
||||
- Works with content stored in a SQLite database
|
||||
- Compatible with `dioxus-web` and `dioxus-desktop`
|
||||
- Optional server integration via Axum for local hosting
|
||||
|
||||
## Usage
|
||||
|
||||
To use Bard in a Dioxus application, you must:
|
||||
|
||||
1. Initialize the database using `bard::init_database`.
|
||||
2. Add the `Router::<bard::Page>` component to your app.
|
||||
3. Optionally, define routes that include Bard under your own layout.
|
||||
|
||||
### Example
|
||||
|
||||
```rust
|
||||
#[component]
|
||||
fn App() -> Element {
|
||||
rsx! {
|
||||
Router::<Page> {}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Routable, Clone, PartialEq)]
|
||||
pub enum Page {
|
||||
#[layout(Navbar)]
|
||||
#[route("/")]
|
||||
Home {},
|
||||
|
||||
#[child("/blog")]
|
||||
Bard
|
||||
{
|
||||
child: bard::Page
|
||||
},
|
||||
|
||||
#[route("/:..route")]
|
||||
PageNotFound { route: Vec<String> }
|
||||
}
|
||||
```
|
||||
|
||||
### Server-side Initialization
|
||||
|
||||
To serve the blog using Axum and load the database:
|
||||
|
||||
```rust
|
||||
tokio::runtime::Runtime::new()
|
||||
.unwrap()
|
||||
.block_on(async move {
|
||||
bard::init_database("path/to/tavern.db").await;
|
||||
});
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
Enable the following Cargo features as needed:
|
||||
|
||||
- `server`: Enables Axum support for database-backed serving
|
||||
- `web`: Enables Dioxus web support
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user