Last active
          July 23, 2018 05:18 
        
      - 
      
 - 
        
Save Kyngo/cce37ac35c10f322eaee9284faea861e to your computer and use it in GitHub Desktop.  
    Prettify pre tags
  
        
  
    
      This file contains hidden or 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
    
  
  
    
  | <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width"> | |
| <title>Pre Prettify</title> | |
| <script src="script.js"></script> | |
| <link rel="stylesheet" type="text/css" href="style.css"> | |
| </head> | |
| <body> | |
| <pre> | |
| <?php | |
| echo "Hello world!"; | |
| phpinfo(); | |
| echo $_POST; | |
| echo $_SESSION; | |
| echo $_GET; | |
| echo "bye!"; | |
| ?> | |
| </pre> | |
| </body> | |
| </html> | 
  
    
      This file contains hidden or 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
    
  
  
    
  | window.onload = function() { | |
| var frames = document.getElementsByTagName("pre"); | |
| Object.keys(frames).forEach(function(frame) { | |
| code = frames[frame].innerHTML.split("\n"); | |
| frames[frame].innerHTML = ""; | |
| Object.keys(code).forEach(function(_code) { | |
| var span = document.createElement("span"); | |
| if (code[_code] !== "" && _code != code.length) { | |
| span.innerHTML = code[_code]; | |
| frames[frame].appendChild(span); | |
| } | |
| }); | |
| }); | |
| } | 
  
    
      This file contains hidden or 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
    
  
  
    
  | pre { | |
| background: #303030; | |
| color: #f1f1f1; | |
| padding: 10px 16px; | |
| border-radius: 2px; | |
| border-top: 4px solid #dd0303; | |
| -moz-box-shadow: inset 0 0 10px #000; | |
| box-shadow: inset 0 0 10px #000; | |
| counter-reset: line; | |
| } | |
| pre span { | |
| display: block; | |
| line-height: 1.5rem; | |
| } | |
| pre span:before { | |
| counter-increment: line; | |
| content: counter(line); | |
| display: inline-block; | |
| border-right: 1px solid #ddd; | |
| padding: 0 .5em; | |
| margin-right: .5em; | |
| color: #888; | |
| width: 30px; | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment