私のレールのブログで作業するための構文ハイライターの取得

Syntax Highlighterを使用して埋め込みコードを美しく見せようとしています。私はhtmlファイルでそれを行うことができますが、私は私のレールのブログを試してもうまくいきません。

私の腸は、それは私のコントローラと関係があると私に伝えます:

puts "Do you use Facebook? (Y/N)"

Entry:

<%=sanitize @thought.entry %>

しかし、上のhtmlのビットはまだうまく動作しています...

<!DOCTYPE HTML>
<html>
<head>
  <title>Blog</title>



  <script src="/assets/shCore.js?body=1" type="text/javascript"></script>
  <script src="/assets/shBrushRuby.js?body=1" type="text/javascript"></script>
  <link href="/assets/shCoreDefault.css?body=1" media="screen" rel="stylesheet" type="text/css" />
  <script type="text/javascript">SyntaxHighlighter.all();</script>
  <meta content="authenticity_token" name="csrf-param" />
<meta content="1OAMJ6dGJ8c7CHunEe9IBkNrcIJwrfYdwtskSFRGvUQ=" name="csrf-token" />
</head>
<body>

Title: Facehook

Entry:

puts "Do you use Facebook? (Y/N)"
facehooked = gets

if facehooked == "Y" #upper- or lower-case?
   puts "How many friends do you have?"
   friends = gets

   if friends > 30 
      puts "I asked how many friends you have. Not how many friends you have on Facebook. You are Facehooked."
   elsif friends == 0
      puts "I am sorry to hear that."
   else
      #How sociable are you in the real world?

      #TODO - data-type checking
      puts "Please answer the following questions with a number:\nHow many people would you like to see on a weekly basis?"
      buddies = gets
      puts "How many people do you happen to see on a weekly basis?"
      acquaintances = gets
      puts "How many people that you do not like do you have to see on a daily basis?"
      forced = gets
      puts "How many people would you love to see on a daily basis?"
      true_friends = gets

      people = buddies + acquaintances + forced + true_friends

      #ratios
      true_friends_to_buddies = true_friends/buddies
      buddies_to_acquaintances = buddes/acquaintances
      true_friends_to_acquaintances = true_friends/aquaintances


      puts "How many 'friends' do you have on Facebook?"
      facehooks = gets

      if people == 0
         puts "You are ninja. You drift among this world without a connection. Please do not kill me."
      elsif people >= 500
         puts "You are one social motherfucker!"
      else

      end




   end

elsif facehooked == "N"
   puts "You do not have a hook in your face. Congratulations."
else
   puts "That question required a yes or no answer."
end

puts "You should follow @ricburton on Twitter - he likes talking to new people, making acquaintances and building friendships."

Edit | Back </body> </html>

どんな助けでも大いに義務づけられます!

0
スタイリングされるコンテンツが読み込まれる前にJavaScriptが発射されているように見える - ページの下部にjsを貼り付ける(一般的には良い方法です)
追加された 著者 Frederick Cheung,

1 答え

どんな助けでも大いに義務づけられます!

For syntax highlighting on rails, i would recommend using using prism.js via the gem highlighting

The integration is extremely simple. You can read more on how to integrate with rails here https://github.com/ytbryan/highlighting

0
追加された