Content-Length: 1790 | pFad | http://github.com/postgresml/postgresml/pull/1231.patch
thub.com
From c6540792ebd0d9a8da02dd55bd319021dae9e428 Mon Sep 17 00:00:00 2001
From: Montana Low
Date: Fri, 8 Dec 2023 19:05:05 -0800
Subject: [PATCH] gitbook page link cleanup
---
pgml-dashboard/src/utils/markdown.rs | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/pgml-dashboard/src/utils/markdown.rs b/pgml-dashboard/src/utils/markdown.rs
index aba253366..c5be4fd49 100644
--- a/pgml-dashboard/src/utils/markdown.rs
+++ b/pgml-dashboard/src/utils/markdown.rs
@@ -917,6 +917,7 @@ pub fn mkdocs<'a>(root: &'a AstNode<'a>, arena: &'a Arena>) -> anyho
iter_nodes(root, &mut |node| {
match &mut node.data.borrow_mut().value {
+ // Strip .md extensions that gitbook includes in page link urls
&mut NodeValue::Link(ref mut link) => {
let path = Path::new(link.url.as_str());
@@ -932,6 +933,21 @@ pub fn mkdocs<'a>(root: &'a AstNode<'a>, arena: &'a Arena>) -> anyho
}
&mut NodeValue::Text(ref mut text) => {
+
+ // Strip .md extensions that gitbook includes in page link text
+ if text.ends_with(".md") {
+ if let Some(parent) = node.parent() {
+ match parent.data.borrow().value {
+ NodeValue::Link(ref link) => {
+ for _ in 0..".md".len() {
+ text.pop();
+ }
+ }
+ _ => {}
+ }
+ }
+ }
+
if text.starts_with("=== \"") {
let mut parent = {
match node.parent() {
--- a PPN by Garber Painting Akron. With Image Size Reduction included!Fetched URL: http://github.com/postgresml/postgresml/pull/1231.patch
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy