summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorveradec <glitchmill.dyj3d@simplelogin.co>2026-10-27 22:00:15 +0530
committerveradec <glitchmill.dyj3d@simplelogin.co>2026-10-27 22:00:15 +0530
commitee8377a7c0f9ebb9f3655c0a350fa9ba0174caf0 (patch)
tree32f0509ebd46da6fc17d855b8013c87cf3409795
init: markdown -> html conversion works
-rw-r--r--.gitignore1
-rw-r--r--Cargo.lock25
-rw-r--r--Cargo.toml7
-rw-r--r--content/contacts.md5
-rw-r--r--content/index.md19
-rw-r--r--src/main.rs59
-rw-r--r--templates/index.html9
7 files changed, 125 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..ea8c4bf
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/target
diff --git a/Cargo.lock b/Cargo.lock
new file mode 100644
index 0000000..4d35cc9
--- /dev/null
+++ b/Cargo.lock
@@ -0,0 +1,25 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 4
+
+[[package]]
+name = "lavender"
+version = "0.1.0"
+dependencies = [
+ "markdown",
+]
+
+[[package]]
+name = "markdown"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a5cab8f2cadc416a82d2e783a1946388b31654d391d1c7d92cc1f03e295b1deb"
+dependencies = [
+ "unicode-id",
+]
+
+[[package]]
+name = "unicode-id"
+version = "0.3.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "65dd75ab2d9d379dbe86d4059e91d8b5a6e7054865eaba1ddbfc7a817ff96392"
diff --git a/Cargo.toml b/Cargo.toml
new file mode 100644
index 0000000..8ce1bae
--- /dev/null
+++ b/Cargo.toml
@@ -0,0 +1,7 @@
+[package]
+name = "lavender"
+version = "0.1.0"
+edition = "2024"
+
+[dependencies]
+markdown = "1.0.0"
diff --git a/content/contacts.md b/content/contacts.md
new file mode 100644
index 0000000..786ff93
--- /dev/null
+++ b/content/contacts.md
@@ -0,0 +1,5 @@
++++
+title="Page Generated by Lavendar"
+description="This page is generated by lavendar"
++++
+
diff --git a/content/index.md b/content/index.md
new file mode 100644
index 0000000..67a1ce9
--- /dev/null
+++ b/content/index.md
@@ -0,0 +1,19 @@
++++
+date=27/10/2026
+title=Page Generated by Lavendar
+description=This page is generated by lavendar
++++
+
+# Hello World
+## I welcome you to Lavendar ig?
+*Bold* _Italic_
+
+1. Ordered List 1
+2. Ordered List 2
+3. Ordered List 3
+4. Ordered List 4
+
+1. Unordered List 1
+2. Unordered List 2
+3. Unordered List 3
+4. Unordered List 4 \ No newline at end of file
diff --git a/src/main.rs b/src/main.rs
new file mode 100644
index 0000000..f125e7b
--- /dev/null
+++ b/src/main.rs
@@ -0,0 +1,59 @@
+#![allow(unused)]
+use markdown;
+use std::env;
+use std::fs;
+use std::path::PathBuf;
+
+struct File {
+ file_name: String,
+ parent_directory: String,
+ date: Option<String>,
+ title: Option<String>,
+ description: Option<String>,
+ content: String,
+}
+
+fn markdown_to_html(path: String, content: String) -> File {
+ let mut end: usize = 0;
+ if &content[0..3] != "+++" {
+ println!("It doesnt pass");
+ }
+
+ let end = content[3..].find("+++").unwrap();
+
+ // if Some(end) == Some(None) {
+ // println!("It doesnt pass");
+ // }
+
+ let meta_data = &content[3..end];
+
+ println!("{meta_data}\n\n");
+
+ let html = markdown::to_html(&content[end + 7..]);
+ let file_name = std::path::Path::new(&path).file_name().unwrap();
+ return File {
+ file_name: file_name.to_str().unwrap().to_string(),
+ parent_directory: path,
+ date: None,
+ title: None,
+ description: None,
+ content: html,
+ };
+}
+
+fn main() {
+ // let contents_path = std::path::Path::new("./content/index.md");
+ let path = "./content/index.md";
+ // let path = std::env::current_dir()
+ // .unwrap()
+ // .into_os_string()
+ // .into_string();
+ // println!("File parent_directory: {}", path);
+
+ let contents_read = fs::read_to_string(path).unwrap();
+ let f: File = markdown_to_html(path.to_string(), contents_read);
+ println!(
+ "file_name: {}\npath:{}\ncontent:\n{}",
+ f.file_name, f.parent_directory, f.content
+ );
+}
diff --git a/templates/index.html b/templates/index.html
new file mode 100644
index 0000000..9ad19d3
--- /dev/null
+++ b/templates/index.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<body>
+
+<h1>My First Heading</h1>
+<p>My first paragraph.</p>
+
+</body>
+</html>