mirror of
https://github.com/System-End/highway.git
synced 2026-04-19 19:45:10 +00:00
markdown stuff
This commit is contained in:
parent
258285ce1c
commit
a8ee572c7e
4 changed files with 22 additions and 0 deletions
4
site/app/controllers/markdown_projects_controller.rb
Normal file
4
site/app/controllers/markdown_projects_controller.rb
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
class MarkdownProjectsController < ApplicationController
|
||||
def index
|
||||
end
|
||||
end
|
||||
4
site/app/views/markdown_projects/index.html.md
Normal file
4
site/app/views/markdown_projects/index.html.md
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
whi
|
||||
# Hello world
|
||||
|
||||
_by acorn_
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
module MarkdownHandler
|
||||
def self.erb
|
||||
@erb ||= ActionView::Template.registered_template_handler(:erb)
|
||||
end
|
||||
|
||||
def self.call(template, source)
|
||||
compiled_source = erb.call(template, source)
|
||||
"Redcarpet::Markdown.new(Redcarpet::Render::HTML.new).render(begin;#{compiled_source};end.to_s).html_safe"
|
||||
end
|
||||
end
|
||||
|
||||
ActionView::Template.register_template_handler :md, MarkdownHandler
|
||||
|
|
@ -14,6 +14,8 @@ Rails.application.routes.draw do
|
|||
resources :posts
|
||||
resources :users
|
||||
resources :projects
|
||||
|
||||
get "/markdown", to: "markdown_projects#index"
|
||||
|
||||
get "/info", to: "info#show"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue