diff --git a/Procfile.dev b/Procfile.dev index c1cb248..02aaaf3 100644 --- a/Procfile.dev +++ b/Procfile.dev @@ -1,3 +1,3 @@ web: env RUBY_DEBUG_OPEN=true bin/rails server js: yarn build --watch -css: yarn build:css --watch +css: yarn build:css --watch=always diff --git a/app/models/markdown_document.rb b/app/models/markdown_document.rb index 18c586e..daac98a 100644 --- a/app/models/markdown_document.rb +++ b/app/models/markdown_document.rb @@ -18,6 +18,10 @@ class MarkdownDocument autolink: true, tasklist: true, footnotes: true }.freeze + # A leading `---` block of YAML, terminated by another `---` line. Common to + # every static-site generator's Markdown dialect (Jekyll, Hugo, Astro, ...). + FRONT_MATTER_PATTERN = /\A---[ \t]*\r?\n(.*?)\r?\n---[ \t]*\r?\n?(.*)\z/m + # Pinned so a stored paste renders identically forever. The ESM build boots # itself via startOnLoad and upgrades every
.
   MERMAID_MODULE = "https://cdn.jsdelivr.net/npm/mermaid@11.4.1/dist/mermaid.esm.min.mjs".freeze
@@ -67,7 +71,7 @@ class MarkdownDocument
   CSS
 
   def initialize(markdown, filename: nil)
-    @markdown = markdown.to_s
+    @front_matter, @markdown = self.class.split_front_matter(markdown.to_s)
     @filename = filename.to_s
   end
 
@@ -81,7 +85,7 @@ def to_html
       
       
       #{CGI.escapeHTML(document_title)}
-      
+      #{description_meta_tag}