-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow project manager to respond to README.{txt,md} files in the project and display them in a collapsible menu.
- Loading branch information
1 parent
1f75395
commit 943e81a
Showing
3 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# frozen_string_literal: true | ||
|
||
# Helpers for the projects page | ||
module ProjectsHelper | ||
def render_readme(readme_location) | ||
file_content = File.read(readme_location) | ||
|
||
if File.extname(readme_location) == '.md' | ||
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML) | ||
markdown_html = markdown.render(file_content).html_safe | ||
sanitize(markdown_html) | ||
elsif File.extname(readme_location) == '.txt' | ||
# simple_format sanitizes its output | ||
simple_format(file_content) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters