about summary refs log tree commit diff
path: root/markup/src
diff options
context:
space:
mode:
authorgennyble <gen@nyble.dev>2026-09-21 15:08:10 -0500
committergennyble <gen@nyble.dev>2026-09-21 15:08:10 -0500
commit279954424d61cd2f5839375f0f352d763c72c2e5 (patch)
treea6dc6fcada8968ed9ca415284e33fcc674da697d /markup/src
parente793d90dd9624acccae852023e4ea4bb8343e3fe (diff)
add markup command to legacy markup
Diffstat (limited to 'markup/src')
-rwxr-xr-xmarkup/src/legacy/state.rs24
1 files changed, 22 insertions, 2 deletions
diff --git a/markup/src/legacy/state.rs b/markup/src/legacy/state.rs
index 35472e3..e6a41e6 100755
--- a/markup/src/legacy/state.rs
+++ b/markup/src/legacy/state.rs
@@ -4,6 +4,7 @@ pub(crate) struct State {
 	active_id: Option<String>,
 	active_fill: Option<FillComand>,
 	paragraphs: bool,
+	markup: bool,
 
 	processed: String,
 	current: String,
@@ -18,6 +19,7 @@ impl Default for State {
 			active_id: None,
 			active_fill: None,
 			paragraphs: true,
+			markup: true,
 
 			processed: String::new(),
 			current: String::new(),
@@ -61,9 +63,17 @@ impl State {
 	fn make_paragraph(&mut self, content: String) -> String {
 		if self.should_paragraph_string(&content) {
 			let open = self.get_open_paragraph();
-			format!("{open}\n{}\n</p>", intra::process(content))
+			format!("{open}\n{}\n</p>", self.markup(content))
 		} else {
-			intra::process(content)
+			self.markup(content)
+		}
+	}
+
+	fn markup(&self, raw: String) -> String {
+		if self.markup {
+			intra::process(raw)
+		} else {
+			raw
 		}
 	}
 
@@ -156,6 +166,16 @@ impl State {
 				self.paragraphs = true;
 				true
 			}
+			"@markup on" => {
+				self.finish_current();
+				self.markup = true;
+				true
+			}
+			"@markup off" => {
+				self.finish_current();
+				self.markup = false;
+				true
+			}
 			"@fill-end" => {
 				self.finish_current();
 				self.finish_active_fill();