Add markdown to html

This commit is contained in:
julien committed 2026-11-01 14:46:05 +01:00
1 parent 5fee20ef9e
commit 145dd95b24
8 files changed
+188 -87

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
require "commonmarker"
class DocumentRenderer
DOCUMENTS = {
legal: "legal.md",
statutes: "statutes.md"
}.freeze
def self.render(name)
filename = DOCUMENTS.fetch(name)
path = File.expand_path("../doc/#{filename}", __dir__)
markdown = File.read(path, encoding: "UTF-8")
Commonmarker.to_html(
markdown,
options: {
render: {
hardbreaks: false,
unsafe: false
}
}
)
end
end