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

Commitaa5f868

Browse files
fix link block html (#1282)
1 parentb987f83 commitaa5f868

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

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

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -742,16 +742,24 @@ pub fn mkdocs<'a>(root: &'a AstNode<'a>, arena: &'a Arena<AstNode<'a>>) -> anyho
742742
_ =>"".to_string(),
743743
};
744744

745-
for _in0..fragment.len() +1{
745+
// Remove fragment and the fragment identifier #.
746+
for _in0..fragment.len()
747+
+match fragment.len(){
748+
0 =>0,
749+
_ =>1,
750+
}
751+
{
746752
link.url.pop();
747753
}
748754

755+
// Remove file path to make this a relative url.
749756
if link.url.ends_with(".md"){
750757
for _in0..".md".len(){
751758
link.url.pop();
752759
}
753760
}
754761

762+
// Add fragment path that matches toc links.
755763
let header_id =TocLink::from_fragment(fragment).id;
756764
for cin header_id.chars(){
757765
link.url.push(c)
@@ -1041,15 +1049,9 @@ pub fn mkdocs<'a>(root: &'a AstNode<'a>, arena: &'a Arena<AstNode<'a>>) -> anyho
10411049
info_block_close_items.push(None);
10421050
parent.detach();
10431051
}elseif text.contains("{% content-ref url="){
1044-
let url =parser(text.as_ref(),r#"url=""#);
1045-
10461052
let n = arena.alloc(Node::new(RefCell::new(Ast::new(NodeValue::HtmlInline(format!(
1047-
r#"<div>
1048-
<a href="{}">
1049-
<div>"#,
1050-
url.unwrap(),
1053+
r#"<div>"#,
10511054
))))));
1052-
10531055
let parent = node.parent().unwrap();
10541056

10551057
info_block_close_items.push(None);
@@ -1096,14 +1098,8 @@ pub fn mkdocs<'a>(root: &'a AstNode<'a>, arena: &'a Arena<AstNode<'a>>) -> anyho
10961098
parent.detach();
10971099
}elseif text.starts_with("{% endcontent-ref %}"){
10981100
let parent = node.parent().unwrap();
1099-
11001101
let n = arena.alloc(Node::new(RefCell::new(Ast::new(NodeValue::HtmlInline(
1101-
r#"
1102-
</div>
1103-
</a>
1104-
</div>
1105-
"#
1106-
.to_string(),
1102+
r#"</div>"#.to_string(),
11071103
)))));
11081104

11091105
parent.insert_after(n);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp