Add markdown to html
This commit is contained in:
1 parent
5fee20ef9e
commit
145dd95b24
8 files changed
+188
-87
No files matched your search
@@ -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
|
||||
Reference in new issue
Block a user