Indentation not applying to wrapped lines. Inspect
This commit is contained in:
parent
b0b07fb590
commit
c071f66cae
1 changed files with 4 additions and 3 deletions
7
main.go
7
main.go
|
|
@ -87,8 +87,8 @@ func readMarkdown(filename string) string {
|
|||
return string(content)
|
||||
}
|
||||
|
||||
|
||||
func renderMarkdown(content string) template.HTML {
|
||||
// Compile regex patterns
|
||||
content = codeBlockPattern.ReplaceAllString(content, "<pre><code>$1</code></pre>")
|
||||
content = inlineCodePattern.ReplaceAllString(content, "<code>$1</code>")
|
||||
content = headerPattern.ReplaceAllString(content, "<h1>$1</h1>")
|
||||
|
|
@ -102,14 +102,15 @@ func renderMarkdown(content string) template.HTML {
|
|||
content = blockquotePattern.ReplaceAllString(content, "<blockquote>$1</blockquote>")
|
||||
content = linkPattern.ReplaceAllString(content, `<a href="$2">$1</a>`)
|
||||
|
||||
// Preserve paragraph structure without breaking inline elements
|
||||
leadingStarPattern := regexp.MustCompile(`(?m)^\*`)
|
||||
content = leadingStarPattern.ReplaceAllString(content, "•")
|
||||
|
||||
paragraphPattern := regexp.MustCompile(`(?m)(^([^#<\n].+)$)\n?`)
|
||||
content = paragraphPattern.ReplaceAllString(content, "<p><pre>$1</pre></p>")
|
||||
|
||||
return template.HTML(content)
|
||||
}
|
||||
|
||||
|
||||
func loadTemplate(name string) *template.Template {
|
||||
tmplPath := filepath.Join(TEMPLATES_DIR, name)
|
||||
tmpl, err := template.ParseFiles(tmplPath)
|
||||
|
|
|
|||
Loading…
Reference in a new issue