summaryrefslogtreecommitdiff
path: root/markup.go
diff options
context:
space:
mode:
Diffstat (limited to 'markup.go')
-rw-r--r--markup.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/markup.go b/markup.go
new file mode 100644
index 0000000..c0a6d45
--- /dev/null
+++ b/markup.go
@@ -0,0 +1,18 @@
+package main
+
+import (
+ "bufio"
+ "strings"
+)
+
+func titleFromMarkup(markup string) string {
+ scanner := bufio.NewScanner(strings.NewReader(markup))
+ for scanner.Scan() {
+ line := scanner.Text()
+ cut, found := strings.CutPrefix(line, "# ")
+ if found {
+ return cut
+ }
+ }
+ return "no title detected"
+}