test-markdown-options.html 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>reveal.js - Test Markdown Options</title>
  6. <link rel="stylesheet" href="../dist/reveal.css">
  7. <link rel="stylesheet" href="qunit-2.5.0.css">
  8. </head>
  9. <body style="overflow: auto;">
  10. <div id="qunit"></div>
  11. <div id="qunit-fixture"></div>
  12. <div class="reveal" style="display: none;">
  13. <div class="slides">
  14. <section data-markdown>
  15. <script type="text/template">
  16. ## Testing Markdown Options
  17. This "slide" should contain 'smart' quotes.
  18. </script>
  19. </section>
  20. </div>
  21. </div>
  22. <script src="qunit-2.5.0.js"></script>
  23. <script type="module">
  24. import '../js/index.js'
  25. import Markdown from '../plugin/markdown/markdown.js'
  26. Reveal.initialize({
  27. dependencies: [ Markdown ],
  28. markdown: {
  29. smartypants: true
  30. }
  31. }).then( function() {
  32. QUnit.module( 'Markdown' );
  33. QUnit.test( 'Options are set', function( assert ) {
  34. assert.strictEqual( Reveal.getPlugin( 'markdown' ).marked.defaults.smartypants, true );
  35. });
  36. QUnit.test( 'Smart quotes are activated', function( assert ) {
  37. var text = document.querySelector( '.reveal .slides>section>p' ).textContent;
  38. assert.strictEqual( /['"]/.test( text ), false );
  39. assert.strictEqual( /[“”‘’]/.test( text ), true );
  40. });
  41. } );
  42. </script>
  43. </body>
  44. </html>