Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7627d4d

Browse files
committed
Fix crashn in docs
1 parentf25ab3f commit7627d4d

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

‎pgml-dashboard/src/utils/markdown.rs‎

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -640,9 +640,13 @@ pub fn get_title<'a>(root: &'a AstNode<'a>) -> anyhow::Result<String> {
640640
match&node.data.borrow().value{
641641
&NodeValue::Heading(ref header) =>{
642642
if header.level ==1{
643-
let content = node
644-
.first_child()
645-
.ok_or(anyhow::anyhow!("markdown heading has no child"))?;
643+
let content =match node.first_child(){
644+
Some(child) => child,
645+
None =>{
646+
warn!("markdown heading has no child");
647+
returnOk(false);
648+
}
649+
};
646650
match&content.data.borrow().value{
647651
&NodeValue::Text(ref text) =>{
648652
title =Some(text.to_owned());
@@ -703,9 +707,13 @@ pub fn get_toc<'a>(root: &'a AstNode<'a>) -> anyhow::Result<Vec<TocLink>> {
703707
&NodeValue::Heading(ref header) =>{
704708
header_counter +=1;
705709
if header.level !=1{
706-
let sibling = node
707-
.first_child()
708-
.ok_or(anyhow::anyhow!("markdown heading has no child"))?;
710+
let sibling =match node.first_child(){
711+
Some(child) => child,
712+
None =>{
713+
warn!("markdown heading has no child");
714+
returnOk(false);
715+
}
716+
};
709717
match&sibling.data.borrow().value{
710718
&NodeValue::Text(ref text) =>{
711719
links.push(TocLink::new(text, header_counter -1).level(header.level));

‎pgml-dashboard/templates/content/playground.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use crate::components::inputs::text::editable_header::{EditableHeader, Headers};
66
use crate::components::stimulus::stimulus_target::StimulusTarget;
77
use crate::components::stimulus::stimulus_action::StimulusAction;
8-
use crate::components::stimulus::stimulus_action::StimulusEvents;
8+
//use crate::components::stimulus::stimulus_action::StimulusEvents;
99
use crate::components::inputs::select::Select;
1010
use crate::components::inputs::switch::Switch;
1111
%>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp