Skip to content

Commit b04c774

Browse files
committed
fix docs
1 parent 60ba4f9 commit b04c774

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

code-editor/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use std::{cell::RefCell, rc::Rc};
88
/// Base stylesheet injected by [`CodeEditor`].
99
pub const CODE_EDITOR_CSS: Asset = asset!("/assets/dioxus-code-editor.css");
1010

11+
/// Props for [`CodeEditor`].
1112
#[derive(Props, Clone, PartialEq)]
1213
pub struct CodeEditorProps {
1314
/// The current editor contents.

src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,14 +451,22 @@ pub fn CodeSpan(props: CodeSpanProps) -> Element {
451451
}
452452
}
453453

454+
/// Props for [`Code`].
454455
#[derive(Props, Clone, PartialEq)]
455456
pub struct CodeProps {
457+
/// Source to render. Accepts anything implementing [`IntoTree`].
456458
#[props(into)]
457459
pub src: CodeSource,
460+
/// Syntax theme. Defaults to [`Theme::RUSTDOC_AYU`].
458461
#[props(default)]
459462
pub theme: Theme,
460463
}
461464

465+
/// Render syntax-highlighted source code.
466+
///
467+
/// Pair the [`code!`] macro for compile-time parsing, or [`SourceCode`] for
468+
/// runtime parsing (with the `runtime` feature). The component injects its
469+
/// own stylesheet plus the selected theme's stylesheet.
462470
#[component]
463471
pub fn Code(props: CodeProps) -> Element {
464472
let CodeTree {

0 commit comments

Comments
 (0)