“highlightjs” Réponses codées

highlightjs

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.5.1/styles/default.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.5.1/highlight.min.js"></script>
<!-- and it's easy to individually load additional languages -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.5.1/languages/go.min.js"></script>
<!-- add custom theme -->
  <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.0.3/styles/vs2015.min.css">
</head>
<body>

  <h2>Python highlight</h2>
    <pre><code class="python">
      def hello_world():
      	return "hello world"
    </code></pre>
      
  <h2>Javascript highlight</h2>
    <pre><code class="javascript">
      function helloWorld(){
      	return "hello world";
      }
	</code></pre>
<script>hljs.initHighlightingOnLoad();</script>
</body>
</html>
Jerome Scott

highlight.js

<link rel="stylesheet"
      href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.2.0/styles/default.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.2.0/highlight.min.js"></script>
Clever Caterpillar

highlight.js

<link rel="stylesheet"
      href="//cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/styles/default.min.css">
<script src="//cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/highlight.min.js"></script>
Upset Unicorn

mettre en surbrillance JS

<link rel="stylesheet" href="/path/to/styles/default.css">
<script src="/path/to/highlight.min.js"></script>
<script>hljs.highlightAll();</script>
Undefined

highlight.js

<link rel="stylesheet"
      href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/styles/default.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/highlight.min.js"></script>
// FÖr att länka highlightjs till HTML för extra funktioner
Important Ibis

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code