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

Commit0b87292

Browse files
authored
gitbook page link cleanup (#1231)
1 parent090481f commit0b87292

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -917,6 +917,7 @@ pub fn mkdocs<'a>(root: &'a AstNode<'a>, arena: &'a Arena<AstNode<'a>>) -> anyho
917917

918918
iter_nodes(root,&mut |node|{
919919
match&mut node.data.borrow_mut().value{
920+
// Strip .md extensions that gitbook includes in page link urls
920921
&mutNodeValue::Link(refmut link) =>{
921922
let path =Path::new(link.url.as_str());
922923

@@ -932,6 +933,21 @@ pub fn mkdocs<'a>(root: &'a AstNode<'a>, arena: &'a Arena<AstNode<'a>>) -> anyho
932933
}
933934

934935
&mutNodeValue::Text(refmut text) =>{
936+
937+
// Strip .md extensions that gitbook includes in page link text
938+
if text.ends_with(".md"){
939+
ifletSome(parent) = node.parent(){
940+
match parent.data.borrow().value{
941+
NodeValue::Link(ref link) =>{
942+
for _in0..".md".len(){
943+
text.pop();
944+
}
945+
}
946+
_ =>{}
947+
}
948+
}
949+
}
950+
935951
if text.starts_with("===\""){
936952
letmut parent ={
937953
match node.parent(){

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp