Skip to main content

desktop_example/app/routes/
markdown.rs

1use freya::prelude::*;
2
3const CONTENT: &str = r#"
4# Freya on Android
5
6This is a **MarkdownViewer** running on Android.
7
8## Features
9
10- **Bold text** and *italic text*
11- ~~Strikethrough~~ text
12- `inline code` snippets
13
14## Code Example
15
16```rust
17fn main() {
18    println!("Hello from Freya!");
19}
20```
21
22## Lists
23
241. First step
252. Second step
263. Third step
27
28> Freya makes it easy to build cross-platform UIs with Rust.
29
30| Component | Status |
31|-----------|--------|
32| Switch | Done |
33| Slider | Done |
34| Select | Done |
35"#;
36
37#[derive(PartialEq)]
38pub struct MarkdownDemo;
39
40impl Component for MarkdownDemo {
41    fn render(&self) -> impl IntoElement {
42        rect().expanded().child(
43            ScrollView::new()
44                .width(Size::fill())
45                .height(Size::fill())
46                .child(MarkdownViewer::new(CONTENT).padding(16.)),
47        )
48    }
49}