Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Descriptionをmarkdownで書けるようにした kentaro/triglav#34 #40

Merged
merged 1 commit into from
Nov 8, 2012

Conversation

glidenote
Copy link
Collaborator

#34 に対応しました…

@kentaro
Copy link
Owner

kentaro commented Nov 7, 2012

簡単なものでいいのでhelperのテストかいてほしー。

# Title

- foo
-bar

hoge

<h1>Title</h1>
<ul>
  <li>foo</li>
  <li>bar</li>
</ul>
<p>hoge</p>

になるぐらいかな。あとはscript通さないようにするとかそのあたり。

@kentaro
Copy link
Owner

kentaro commented Nov 7, 2012

あとhtml_safeしてるとscriptとか通っちゃいそうですね。以下とかみて、適切なオプションを有効にするとかかなー。

https://github.com/ged/bluecloth/blob/master/lib/bluecloth.rb#L65

@glidenote
Copy link
Collaborator Author

なるほど。ちょっと勉強します…

optionは対応しました。

diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb                                                                                                                              
index be4601f..98df4dd 100644                                                                                                                                                                                   
--- a/app/helpers/application_helper.rb                                                                                                                                                                         
+++ b/app/helpers/application_helper.rb                                                                                                                                                                         
@@ -28,6 +28,7 @@ module ApplicationHelper                                                                                                                                                                      
   end                                                                               

   def markdown(text)                                                                                       
-    BlueCloth.new(text).to_html.html_safe                                                                                                                                                                      
+    options = [:escape_html => true, :auto_links => true,]                                                                                                                                                     
+    BlueCloth.new(text, *options).to_html.html_safe                                                                                                                                                            
   end                                                           
 end

@glidenote
Copy link
Collaborator Author

指摘の内容を修正しました…

<p>hoge</p>
EOF

helper.markdown(markdown_text).should == html_text.chomp
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expect(helper.markdown(markdown_text)).to be == html_text.chomp にしてください。

@@ -0,0 +1,30 @@
require 'spec_helper'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@glidenote
Copy link
Collaborator Author

指摘もらった部分を修正するとコメントごと消えるんですね…

@glidenote
Copy link
Collaborator Author

app/helpers/application_helper.rbも修正済みしました

kentaro added a commit that referenced this pull request Nov 8, 2012
Descriptionをmarkdownで書けるようにした #34
@kentaro kentaro merged commit bab002f into kentaro:master Nov 8, 2012
@kentaro
Copy link
Owner

kentaro commented Nov 8, 2012

Great! Thanks!!1

@kyanny
Copy link
Collaborator

kyanny commented Nov 8, 2012

@glidenote

http://192.168.25.37/gyazo/data/7bef06f87e472f8ae5e4f8a766f37709.png
show outdated diff をクリックすると過去のレビューコメントが表示できます。

@kentaro
Copy link
Owner

kentaro commented Nov 8, 2012

社内LANの貼らないようにw

@glidenote
Copy link
Collaborator Author

@kyanny
おお、ありがとうございます!!
知らなかった

@kentaro
社外からも見れるように画像転載しました

@kyanny
Copy link
Collaborator

kyanny commented Nov 8, 2012

oops public repo でした失礼

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants