diff --git a/MarkdownViewer/ContentView.swift b/MarkdownViewer/ContentView.swift
index 5500be4..15d8da0 100644
--- a/MarkdownViewer/ContentView.swift
+++ b/MarkdownViewer/ContentView.swift
@@ -14,12 +14,6 @@ struct ContentView: View {
}
.padding()
- Button("Test with Sample Content") {
- markdownContent = "# Test\n\nThis is **test** content."
- print("Set test content: \(markdownContent)")
- }
- .padding()
-
if let url = selectedFileURL {
Text("File: \(url.lastPathComponent)")
.foregroundColor(.secondary)
diff --git a/MarkdownViewer/MarkdownRenderer.swift b/MarkdownViewer/MarkdownRenderer.swift
index ea680b1..03e4ce8 100644
--- a/MarkdownViewer/MarkdownRenderer.swift
+++ b/MarkdownViewer/MarkdownRenderer.swift
@@ -77,6 +77,10 @@ struct MarkdownRenderer: NSViewRepresentable {
let codeRegex = try! NSRegularExpression(pattern: "`([^`]+)`", options: [])
html = codeRegex.stringByReplacingMatches(in: html, options: [], range: NSRange(location: 0, length: html.count), withTemplate: "$1")
+ // Handle horizontal rules (-- on its own line)
+ let hrRegex = try! NSRegularExpression(pattern: "^--$", options: [.anchorsMatchLines])
+ html = hrRegex.stringByReplacingMatches(in: html, options: [], range: NSRange(location: 0, length: html.count), withTemplate: "
" + trimmed.replacingOccurrences(of: "\n", with: "
") + "