From b6d7e2d09e9bcbc60cbcea17d156b247094fb5b7 Mon Sep 17 00:00:00 2001 From: girst Date: Sun, 20 Sep 2020 14:36:08 +0200 Subject: [PATCH] WIP: provided local documentation from within the extension should be accessible when clicking "Documentation" in options.xhtml. needs tags, images don't work yet, and integration into options. --- gulpfile.coffee | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/gulpfile.coffee b/gulpfile.coffee index d1c93c7..aff6ef1 100644 --- a/gulpfile.coffee +++ b/gulpfile.coffee @@ -54,6 +54,33 @@ gulp.task('node_modules', -> .pipe(gulp.dest("#{DEST}/node_modules")) ) +gulp.task('docs', -> + gulp.src('documentation/*.md') + .pipe(tap((file) -> + renderer = new marked.Renderer() + renderer.link = (href, title, text) -> + href = href.replace(/\.md$/, ".html") + link = marked.Renderer.prototype.link.call(this, href, title, text) + marked.setOptions({ renderer, gfm: true }) + + HTMLPrelude = ''' + <!doctype html> + <meta charset=utf-8> + <title>VimFx Documentation + + ''' + + file.contents = new Buffer.from(HTMLPrelude + marked(file.contents.toString())) + )) + .pipe(tap((file) -> + file.path = file.path.replace(/\/README\./, '/index.') + file.path = file.path.replace(/\.md$/, '.html') + )) + .pipe(gulp.dest("#{DEST}/documentation")) +) + gulp.task('coffee', -> test = '--test' in argv or '-t' in argv gulp.src( @@ -138,14 +165,7 @@ gulp.task('xpi-only', -> gulp.task('xpi', gulp.series('build', 'xpi-only')) -gulp.task('push-only', -> - body = fs.readFileSync(join(DEST, XPI)) - request.post({url: 'http://localhost:8888', body}) -) - -gulp.task('push', gulp.series('xpi', 'push-only')) - -gulp.task('default', gulp.series('push')) +gulp.task('default', gulp.series('xpi', 'docs')) # coffeelint-forbidden-keywords has `require('coffee-script/register');` in its # index.js :( -- 2.39.3