diff --git a/.gitignore b/.gitignore index 8cfc84b4..59c6904d 100644 --- a/.gitignore +++ b/.gitignore @@ -105,3 +105,5 @@ xunit.xml *.vsix test-report.xml + +.fake \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f24d29c..1e657c0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 4.3.2 + +- Use ExpressJS 5 and EJS +- Split EJS views +- Add new themes : cern, hull-blue, material, myplanet, object-partners, pikestreet, puzzle, robot-lung-ebi, robot-lung, savasian, sfeir-school, sunblind, tidy +- Add slide borders +- Add cssvariables +- Add init override using init.js file + ## 4.3.1 - Update Revealjs to 4.3.1 diff --git a/package.json b/package.json index 88c4ecf0..b98f25c8 100644 --- a/package.json +++ b/package.json @@ -2,12 +2,12 @@ "name": "vscode-reveal", "displayName": "vscode-reveal", "description": "Show markdown as revealJs presentation", - "version": "4.3.1", + "version": "4.3.2", "publisher": "evilz", "author": "Vincent Bourdon", "license": "MIT", "icon": "logo.png", - "preview": true, + "preview": false, "repository": { "type": "git", "url": "https://github.com/evilz/vscode-reveal" @@ -481,6 +481,22 @@ "type": "string", "default": "Reveal JS presentation", "description": "Title of your presentation" + }, + "revealjs.css": { + "type": "array", + "default": [], + "items": { + "type": "string" + }, + "description": "External css file to use" + }, + "revealjs.cssvariables": { + "type": [ + "object", + "null" + ], + "default": null, + "description": "Css variable to add see https://github.com/hakimel/reveal.js/blob/master/css/theme/template/exposer.scss" } } }, diff --git a/samples/themes/base.md b/samples/themes/base.md index 8b044d36..fa42504f 100644 --- a/samples/themes/base.md +++ b/samples/themes/base.md @@ -2,7 +2,6 @@ theme: myplanet --- - # Heading # H1 diff --git a/samples/themes/init.js b/samples/themes/init.js new file mode 100644 index 00000000..0a230c90 --- /dev/null +++ b/samples/themes/init.js @@ -0,0 +1 @@ +alert('hello') diff --git a/src/Configuration.ts b/src/Configuration.ts index a89711c1..0a78e1ef 100644 --- a/src/Configuration.ts +++ b/src/Configuration.ts @@ -84,6 +84,7 @@ export interface IRevealOptions { enableSearch: boolean css: string[] + cssvariables: object | null } export interface IExtensionOptions { slideExplorerEnabled: boolean @@ -167,7 +168,8 @@ export const defaultConfiguration: Configuration = { enableZoom: true, enableSearch: true, - css: [] + css: [], + cssvariables: null } diff --git a/src/RevealServer.ts b/src/RevealServer.ts index 0dd510d7..e24522f6 100644 --- a/src/RevealServer.ts +++ b/src/RevealServer.ts @@ -1,4 +1,5 @@ import * as http from 'http' +import * as fs from 'fs' import express from 'express' import cors from 'cors' import morgan from 'morgan' @@ -108,12 +109,21 @@ export class RevealServer extends Disposable { next() } else { + + const opts = {} + if (context.dirname) { + const initPath = path.join(context.dirname, 'init.js') + if (fs.existsSync(initPath)) { + opts["init"] = fs.readFileSync(initPath, "utf8"); + } + } + const htmlSlides = context.slides.map((s) => ({ ...s, html: markdownit.render(s.text), children: s.verticalChildren.map((c) => ({ ...c, html: markdownit.render(c.text) })), })) - res.render('index', { slides: htmlSlides, ...context.configuration, rootUrl: this.uri }) + res.render('index', { slides: htmlSlides, ...context.configuration, rootUrl: this.uri, ...opts }) } }) diff --git a/views/cssvariables.ejs b/views/cssvariables.ejs new file mode 100644 index 00000000..cb9ea4eb --- /dev/null +++ b/views/cssvariables.ejs @@ -0,0 +1,11 @@ +<% if (cssvariables) { %> + +<% } %> \ No newline at end of file diff --git a/views/head.ejs b/views/head.ejs index 5cb95f78..2e5cfabf 100644 --- a/views/head.ejs +++ b/views/head.ejs @@ -1,46 +1,45 @@ -
- + -