Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

149
Views
¿Prism.js molesta a Ajax?

Tengo dos archivos de código Python simples hello.py y world.py .

 print("hello")
 print("world")

Basado en esta forma , escribí, usando tanto Prism.js como Ajax, un archivo HTML helloworld.htm que formatea y presenta hello.py o world.py a la vez de la siguiente manera.

 <!doctype html> <script src=https://cdnjs.cloudflare.com/ajax/libs/prism/1.25.0/prism.min.js></script> <script src=https://cdnjs.cloudflare.com/ajax/libs/prism/1.25.0/plugins/line-numbers/prism-line-numbers.min.js></script> <script src=https://cdnjs.cloudflare.com/ajax/libs/prism/1.25.0/components/prism-python.min.js></script> <link rel=stylesheet href=https://cdnjs.cloudflare.com/ajax/libs/prism/1.25.0/themes/prism.min.css> <link rel=stylesheet href=https://cdnjs.cloudflare.com/ajax/libs/prism/1.25.0/plugins/line-numbers/prism-line-numbers.min.css> <link rel=stylesheet href=https://cdnjs.cloudflare.com/ajax/libs/prism/1.25.0/themes/prism-coy.min.css> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script type="text/javascript"> function btnclick(_url){ $.ajax({ url : _url, type : 'post', success: function(data) { $('#DIVID').html(data); }, error: function() { $('#DIVID').text('An error occurred'); } }); } </script> <div style="width:50%;height:100%;position:fixed;top:0;left:0"> <a href="cursor:pointer" onclick="btnclick('hello.py')">hello.py</a><br> <a href="cursor:pointer" onclick="btnclick('world.py')">world.py</a> <div style="width:50%;height:100%;position:fixed;top:0;left:50%"> <pre class=line-numbers><code class=lang-py><div id="DIVID"><?php include('hello.py');?></div></code></pre>

Lamentablemente, este archivo HTML no funciona correctamente con <code class=lang-py> en la última línea. Aunque <code> en lugar de <code class=lang-py> resuelve este problema, todavía quiero usar Prism.js para formatear los archivos de código. ¿Cómo puedo abordar este problema?

PD Parece que este problema está relacionado con Cómo volver a ejecutar Prism.js en contenido AJAX y que Prism.highlightAll(); debe ejecutarse junto con Ajax, aunque no pude encontrar la ubicación correcta de Prism.highlightAll(); aún.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!