2013年3月7日木曜日

SyntaxHighlighterをHTMLに適用

SyntaxhighlighterをHTMLに適用するには、
  • SyntaxHighlighterからダウンロードし、サーバーにアップする
  • 適用したいHTMLにCSSを適用し、Scriptを記述する
    <head>部
    1. <link rel = "stylesheet" type = "text/css" href = "../../material/SyntaxHighlighter/3.0.83/styles/shCore.css">  
    2. <link rel = "stylesheet" type = "text/css" href = "../../material/SyntaxHighlighter/3.0.83/styles/shThemeDefault.css">  
    3.   
    4. <script type = "text/javascript" src = "../../material/SyntaxHighlighter/3.0.83/scripts/shCore.js"></script>  
    5. <script type = "text/javascript" src = "../../material/SyntaxHighlighter/3.0.83/scripts/shBrushJScript.js"></script>  
    6. <script type = "text/javascript">  
    7.  SyntaxHighlighter.all()  
    8. </script>  
    <body>部
    1. <pre class = "brush : js">  
    2.  function func()  
    3.  {  
    4.  }  
    5. </pre>  
sample