index.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  1. var path = require('path');
  2. var tester = require('gitbook-tester');
  3. var assert = require('assert');
  4. var pkg = require('../package.json');
  5. describe('emphasize', function() {
  6. it('should correctly replace by span block', function() {
  7. return tester.builder()
  8. .withContent('#test me \n\nHello world. {% em %}highlight{% endem %}')
  9. .withLocalPlugin(path.join(__dirname, '..'))
  10. .withBookJson({
  11. gitbook: pkg.engines.gitbook,
  12. plugins: ['emphasize']
  13. })
  14. .create()
  15. .then(function(result) {
  16. assert.equal(result[0].content, '<h1 id="test-me">test me</h1>\n<p>Hello world. <span class="pg-emphasize pg-emphasize-yellow" style="">highlight</span></p>')
  17. });
  18. });
  19. it('should accept inline markdown', function() {
  20. return tester.builder()
  21. .withContent('#test me \n\nHello world. {% em %}highlight **bold**{% endem %}')
  22. .withLocalPlugin(path.join(__dirname, '..'))
  23. .withBookJson({
  24. gitbook: pkg.engines.gitbook,
  25. plugins: ['emphasize']
  26. })
  27. .create()
  28. .then(function(result) {
  29. assert.equal(result[0].content, '<h1 id="test-me">test me</h1>\n<p>Hello world. <span class="pg-emphasize pg-emphasize-yellow" style="">highlight <strong>bold</strong></span></p>')
  30. });
  31. });
  32. });