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 @@ - - + - <%= title %> + <%= title %> - - + + - - + + - + - - + + - + - - <% if (highlightTheme) { %> - - <%}%> + + <% if (highlightTheme) { %> + + <%}%> <% if (highlightTheme == null) { %> - - <%}%> + + <%}%> <% if (enableMenu ) { %> - - <%}%> + + <%}%> <% if (theme) { %> - + <%}%> <% if (!theme) { %> - + <%}%> @@ -50,12 +49,14 @@ <% if (customTheme) { %> - + <%}%> <% for(var i=0; i < css.length; i++) { %> - - <%}%> + + <%}%> + + <%- include('cssvariables'); %> \ No newline at end of file diff --git a/views/index.ejs b/views/index.ejs index 180a2928..7aa386c3 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -3,7 +3,6 @@ <%- include('head'); %> - <%- include('logo'); %> diff --git a/views/init.ejs b/views/init.ejs index 14501a93..17d89915 100644 --- a/views/init.ejs +++ b/views/init.ejs @@ -1,4 +1,8 @@ \ No newline at end of file diff --git a/views/layouts/main.edge b/views/layouts/main.edge deleted file mode 100644 index 65020a85..00000000 --- a/views/layouts/main.edge +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - {{title}} - - - - - - - - - - - - - - - - - @if(highlightTheme) - - @else - - @endif - - - - @if(enableMenu) - - @endif - - - @if(theme) - - @else - - @endif - - - - - - - @if(customTheme) - - @endif - - - @each(c in css) - - @endeach - - - - - - @include('partials.logo') - -
- -
- - @!section('body') - -
- - -
- - - @if(enableZoom) - - @endif - - - @include('partials.init') - - - - \ No newline at end of file diff --git a/views/layouts/save.edge b/views/layouts/save.edge deleted file mode 100644 index 579ab5fa..00000000 --- a/views/layouts/save.edge +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - {{title}} - - - - - - - - - - - - - - - - - - @if (highlightTheme) - - @else - - @endif - - - - @if (enableMenu) - - @endif - - - - - - @if (theme) - - @else - - - @endif - - - - - - - - - @if (customTheme) - - @end - - - @each(c in css) - - @end - - - - - - {{--@include('partials/logo') --}} - - - -
- - -
- - {{-- @!section('body') --}} - -
- - -
- - - - @if(enableZoom) - - @end - - @if(enableSearch) - - @end - - - @if(enableMenu) - - @end - - - - - - - - - - - - - - - - - - - - @if(enableChalkboard) - - @end - - - - - - - - - - - - \ No newline at end of file diff --git a/views/partials/init.edge b/views/partials/init.edge deleted file mode 100644 index 2f1259d2..00000000 --- a/views/partials/init.edge +++ /dev/null @@ -1,231 +0,0 @@ - - - - -@if(enableChalkboard) - -@endif - -{{-- -const plugins = [...printPlugins, -@if(enableZoom) -RevealZoom, -@endif -@if(enableSearch) -RevealSearch, -@endif -RevealMarkdown, -@if(enableMenu) -RevealMenu, -@end -RevealFullscreen, -RevealAnything, -//RevealAudioSlideshow, -//RevealAudioRecorder, -@if(enableMenu) -RevealCustomControls, -@end -// poll -// question -// seminar -Verticator -] ---}} - - \ No newline at end of file diff --git a/views/partials/logo.edge b/views/partials/logo.edge deleted file mode 100644 index cf9ba8dc..00000000 --- a/views/partials/logo.edge +++ /dev/null @@ -1,5 +0,0 @@ -@if(logoImg) - -@endif \ No newline at end of file