aboutsummaryrefslogtreecommitdiffstats
path: root/markdown-tool
diff options
context:
space:
mode:
authorLibravatarLarge Libravatar memdmp <memdmpestrogenzone>2025-01-15 15:28:50 +0100
committerLibravatarLarge Libravatar memdmp <memdmpestrogenzone>2025-01-15 15:28:50 +0100
commit480afc3101edae1a1272d35eae8ab0eb2af36084 (patch)
treeae4e749f58fcd210fff2a2a26efb7006aacc4e5b /markdown-tool
parent8df49d104cb8e376f469b936fce75e8ccabd19a6 (diff)
downloadcgit-oci-480afc3101edae1a1272d35eae8ab0eb2af36084.tar.gz
cgit-oci-480afc3101edae1a1272d35eae8ab0eb2af36084.tar.bz2
cgit-oci-480afc3101edae1a1272d35eae8ab0eb2af36084.tar.lz
cgit-oci-480afc3101edae1a1272d35eae8ab0eb2af36084.zip

fix: allow block comments for the markdown renderer to skip sections

Diffstat (limited to 'markdown-tool')
-rw-r--r--markdown-tool/src/main.rs15
1 files changed, 12 insertions, 3 deletions
diff --git a/markdown-tool/src/main.rs b/markdown-tool/src/main.rs
index 5263e0e..e41ff5f 100644
--- a/markdown-tool/src/main.rs
+++ b/markdown-tool/src/main.rs
@@ -5,10 +5,19 @@ use pulldown_cmark::{html, Options, Parser};
fn main() {
let stdin = std::io::stdin();
let mut markdown_input = format!("");
+ let mut disabled = false;
for line in stdin.lock().lines() {
- let line = line.unwrap();
- if !line.contains("<!-- NO-CGIT -->") {
- markdown_input = format!("{markdown_input}{line}\n")
+ let mut line = line.unwrap();
+ if disabled && line.contains("<!-- !END-NO-CGIT! -->") {
+ disabled = false;
+ line = line.replace("!END-NO-CGIT!", "Removed Block");
+ }
+ if !disabled {
+ if line.contains("<!-- !BEGIN-NO-CGIT! -->") {
+ disabled = true
+ } else if !line.contains("<!-- NO-CGIT -->") {
+ markdown_input = format!("{markdown_input}{line}\n")
+ }
}
}