diff --git a/public/js/extra.js b/public/js/extra.js index 6e3b0ed0e..c72007b6f 100644 --- a/public/js/extra.js +++ b/public/js/extra.js @@ -681,21 +681,18 @@ export function exportToHTML (view) { const tocAffix = $('#ui-toc-affix').clone() tocAffix.find('*').removeClass('active').find("a[href^='#'][smoothhashscroll]").removeAttr('smoothhashscroll') // generate html via template - $.get(`${serverurl}/build/html.min.css`, css => { - $.get(`${serverurl}/views/html.hbs`, template => { - let html = template.replace('{{{url}}}', serverurl) - html = html.replace('{{title}}', title) - html = html.replace('{{{css}}}', css) - html = html.replace('{{{html}}}', src[0].outerHTML) - html = html.replace('{{{ui-toc}}}', toc.html()) - html = html.replace('{{{ui-toc-affix}}}', tocAffix.html()) - html = html.replace('{{{lang}}}', (md && md.meta && md.meta.lang) ? `lang="${md.meta.lang}"` : '') - html = html.replace('{{{dir}}}', (md && md.meta && md.meta.dir) ? `dir="${md.meta.dir}"` : '') - const blob = new Blob([html], { - type: 'text/html;charset=utf-8' - }) - saveAs(blob, filename, true) + $.get(`${serverurl}/build/htmlexport.html`, template => { + let html = template.replace('{{{url}}}', serverurl) + html = html.replace('{{title}}', title) + html = html.replace('{{{html}}}', src[0].outerHTML) + html = html.replace('{{{ui-toc}}}', toc.html()) + html = html.replace('{{{ui-toc-affix}}}', tocAffix.html()) + html = html.replace('{{{lang}}}', (md && md.meta && md.meta.lang) ? `lang="${md.meta.lang}"` : '') + html = html.replace('{{{dir}}}', (md && md.meta && md.meta.dir) ? `dir="${md.meta.dir}"` : '') + const blob = new Blob([html], { + type: 'text/html;charset=utf-8' }) + saveAs(blob, filename, true) }) } diff --git a/public/js/htmlExport.js b/public/js/htmlExport.js index 1a873aca0..676e2b1bc 100644 --- a/public/js/htmlExport.js +++ b/public/js/htmlExport.js @@ -1,6 +1,25 @@ +require('bootstrap/dist/css/bootstrap.min.css') +require('fork-awesome/css/fork-awesome.min.css') +require('ionicons/css/ionicons.min.css') +require('prismjs/prism') +require('prismjs/themes/prism.css') +require('prismjs/components/prism-wiki') +require('prismjs/components/prism-haskell') +require('prismjs/components/prism-go') +require('prismjs/components/prism-typescript') +require('prismjs/components/prism-jsx') +require('prismjs/components/prism-makefile') +require('prismjs/components/prism-gherkin') +require('highlight.js/styles/github-gist.css') +require('emojify.js/dist/css/basic/emojify.min.css') require('../css/github-extract.css') require('../css/markdown.css') require('../css/extra.css') require('../css/slide-preview.css') -require('../css/google-font.css') +require('../css/font.css') require('../css/site.css') +const $ = require('jquery') +window.jQuery = $ +window.$ = $ +require('bootstrap') +require('gist-embed/gist-embed.min') diff --git a/public/views/html.hbs b/public/views/htmlexport.ejs similarity index 71% rename from public/views/html.hbs rename to public/views/htmlexport.ejs index 7e8268ba3..ee83d8505 100644 --- a/public/views/html.hbs +++ b/public/views/htmlexport.ejs @@ -19,22 +19,7 @@ - - - - - - - - - - + <% _.forEach(htmlWebpackPlugin.files.css, function(cssFile) { %><% }); %> @@ -52,9 +37,7 @@ - - - + <% _.forEach(htmlWebpackPlugin.files.js, function(jsFile) { %><% }); %>