From a2fe001dda2a4b80a6c60b6e5be9f1a6e7378cfd Mon Sep 17 00:00:00 2001 From: Lars Kappert Date: Sun, 4 Dec 2022 20:13:04 -0300 Subject: [PATCH] Fix whitespace & formatting --- README.md | 10 +++++----- lib/render.js | 17 +++++++---------- lib/static.js | 12 ++++++++++-- test/slidify.spec.js | 15 ++++++--------- 4 files changed, 28 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index a0739bb..635f389 100644 --- a/README.md +++ b/README.md @@ -92,17 +92,17 @@ Note: speaker notes FTW! ##### Syntax highlighting -~~~mkdn +````mkdn ```js -console.log('Hello world!') +console.log('Hello world!'); ``` -~~~ +```` ##### Highlight some lines You can highlight one line, multiple lines or both. -~~~mkdn +````mkdn ```python [1|3-6] n = 0 while n < 10: @@ -112,7 +112,7 @@ while n < 10: print(f"{n} is odd") n += 1 ``` -~~~ +```` ### Theme diff --git a/lib/render.js b/lib/render.js index e1bd813..5315799 100644 --- a/lib/render.js +++ b/lib/render.js @@ -57,22 +57,19 @@ const render = async (input, extraOptions = {}) => { }; const renderFile = async (filePath, extraOptions) => { - try{ + try { const content = await fs.readFile(filePath); return render(content.toString(), extraOptions); - }catch(e) - { - return render("File not found.", extraOptions) + } catch (e) { + return render('File not found.', extraOptions); } }; -function sanitize(entry) -{ - if(entry.includes("..")) - { - entry = sanitize(entry.replace("..","")) +function sanitize(entry) { + if (entry.includes('..')) { + entry = sanitize(entry.replace('..', '')); } - return entry + return entry; } module.exports = async (req, res) => { diff --git a/lib/static.js b/lib/static.js index 0e795e6..3329819 100644 --- a/lib/static.js +++ b/lib/static.js @@ -2,8 +2,16 @@ const fs = require('fs-extra'); const path = require('path'); const _ = require('lodash'); -const { getOptions, getAssetsDir, getPath, getStaticDir, getSlideOptions, getFilesGlob, getFaviconPath } = require('./config'); -const { md, isDirectory, isFile, parseYamlFrontMatter, getFilePaths, isAbsoluteURL } = require('./util'); +const { + getOptions, + getAssetsDir, + getPath, + getStaticDir, + getSlideOptions, + getFilesGlob, + getFaviconPath +} = require('./config'); +const { md, isDirectory, parseYamlFrontMatter, getFilePaths, isAbsoluteURL } = require('./util'); const { revealBasePath, highlightThemePath } = require('./constants'); const { renderFile } = require('./render'); const { renderListFile } = require('./listing'); diff --git a/test/slidify.spec.js b/test/slidify.spec.js index ee237e2..4022d2d 100644 --- a/test/slidify.spec.js +++ b/test/slidify.spec.js @@ -6,8 +6,7 @@ test('should render slides split by horizontal separator', () => { const actual = slidify('Slide A\n\n---\n\nSlide B'); assert.equal( actual, - '' + - '
' + + '
' + '
' ); }); @@ -16,8 +15,7 @@ test('should render sub slides split by vertical separator', () => { const actual = slidify('Slide A\n\n---\n\nSlide B\n\n----\n\nSlide C'); assert.equal( actual, - '' + - '
' + + '
' + '
' + '
' + '
' + @@ -29,8 +27,7 @@ test('should render slides split by custom separators', () => { const actual = slidify('Slide A\n\n\nSlide B\n\nSlide C', { separator: '\n\n\n', verticalSeparator: '\n\n' }); assert.equal( actual, - '' + - '
' + + '
' + '
' + '
' + '
' + @@ -42,7 +39,8 @@ test('should render speaker notes', () => { const actual = slidify('Slide A\n\nNote: test'); assert.equal( actual, - '
' + '
' + + '
' ); }); @@ -50,8 +48,7 @@ test('should ignore comments (e.g. custom slide attributes)', () => { const actual = slidify('Slide A\n\n---\n\n\nSlide B'); assert.equal( actual, - '' + - '
' + + '
' + '
' ); });