25 lines
461 B
Ruby
25 lines
461 B
Ruby
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
|