Skip to content

Instantly share code, notes, and snippets.

@emad-elsaid
Created December 6, 2018 12:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emad-elsaid/b0046736d1f943ef784ea586d7c92332 to your computer and use it in GitHub Desktop.
Save emad-elsaid/b0046736d1f943ef784ea586d7c92332 to your computer and use it in GitHub Desktop.
#!/usr/bin/env erbview
<%
require 'redcarpet'
file = File.read(ARGV.shift)
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, autolink: true, tables: true)
output = markdown.render(file)
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/2.10.0/github-markdown.css">
<style>
.markdown-body {
box-sizing: border-box;
min-width: 200px;
max-width: 980px;
margin: 0 auto;
padding: 45px;
}
@media (max-width: 767px) {
.markdown-body {
padding: 15px;
}
}
</style>
</head>
<body class="markdown-body">
<%= output %>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment