File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ use std::{cell::RefCell, rc::Rc};
88/// Base stylesheet injected by [`CodeEditor`].
99pub const CODE_EDITOR_CSS : Asset = asset ! ( "/assets/dioxus-code-editor.css" ) ;
1010
11+ /// Props for [`CodeEditor`].
1112#[ derive( Props , Clone , PartialEq ) ]
1213pub struct CodeEditorProps {
1314 /// The current editor contents.
Original file line number Diff line number Diff line change @@ -451,14 +451,22 @@ pub fn CodeSpan(props: CodeSpanProps) -> Element {
451451 }
452452}
453453
454+ /// Props for [`Code`].
454455#[ derive( Props , Clone , PartialEq ) ]
455456pub 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]
463471pub fn Code ( props : CodeProps ) -> Element {
464472 let CodeTree {
You can’t perform that action at this time.
0 commit comments