Skip to content

Commit a2fe001

Browse files
committed
Fix whitespace & formatting
1 parent 637c2ca commit a2fe001

File tree

4 files changed

+28
-26
lines changed

4 files changed

+28
-26
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,17 +92,17 @@ Note: speaker notes FTW!
9292

9393
##### Syntax highlighting
9494

95-
~~~mkdn
95+
````mkdn
9696
```js
97-
console.log('Hello world!')
97+
console.log('Hello world!');
9898
```
99-
~~~
99+
````
100100

101101
##### Highlight some lines
102102

103103
You can highlight one line, multiple lines or both.
104104

105-
~~~mkdn
105+
````mkdn
106106
```python [1|3-6]
107107
n = 0
108108
while n < 10:
@@ -112,7 +112,7 @@ while n < 10:
112112
print(f"{n} is odd")
113113
n += 1
114114
```
115-
~~~
115+
````
116116

117117
### Theme
118118

lib/render.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,19 @@ const render = async (input, extraOptions = {}) => {
5757
};
5858

5959
const renderFile = async (filePath, extraOptions) => {
60-
try{
60+
try {
6161
const content = await fs.readFile(filePath);
6262
return render(content.toString(), extraOptions);
63-
}catch(e)
64-
{
65-
return render("File not found.", extraOptions)
63+
} catch (e) {
64+
return render('File not found.', extraOptions);
6665
}
6766
};
6867

69-
function sanitize(entry)
70-
{
71-
if(entry.includes(".."))
72-
{
73-
entry = sanitize(entry.replace("..",""))
68+
function sanitize(entry) {
69+
if (entry.includes('..')) {
70+
entry = sanitize(entry.replace('..', ''));
7471
}
75-
return entry
72+
return entry;
7673
}
7774

7875
module.exports = async (req, res) => {

lib/static.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,16 @@
22
const fs = require('fs-extra');
33
const path = require('path');
44
const _ = require('lodash');
5-
const { getOptions, getAssetsDir, getPath, getStaticDir, getSlideOptions, getFilesGlob, getFaviconPath } = require('./config');
6-
const { md, isDirectory, isFile, parseYamlFrontMatter, getFilePaths, isAbsoluteURL } = require('./util');
5+
const {
6+
getOptions,
7+
getAssetsDir,
8+
getPath,
9+
getStaticDir,
10+
getSlideOptions,
11+
getFilesGlob,
12+
getFaviconPath
13+
} = require('./config');
14+
const { md, isDirectory, parseYamlFrontMatter, getFilePaths, isAbsoluteURL } = require('./util');
715
const { revealBasePath, highlightThemePath } = require('./constants');
816
const { renderFile } = require('./render');
917
const { renderListFile } = require('./listing');

test/slidify.spec.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ test('should render slides split by horizontal separator', () => {
66
const actual = slidify('Slide A\n\n---\n\nSlide B');
77
assert.equal(
88
actual,
9-
'' +
10-
'<section data-markdown><script type="text/template">Slide A\n</script></section>' +
9+
'<section data-markdown><script type="text/template">Slide A\n</script></section>' +
1110
'<section data-markdown><script type="text/template">\nSlide B</script></section>'
1211
);
1312
});
@@ -16,8 +15,7 @@ test('should render sub slides split by vertical separator', () => {
1615
const actual = slidify('Slide A\n\n---\n\nSlide B\n\n----\n\nSlide C');
1716
assert.equal(
1817
actual,
19-
'' +
20-
'<section data-markdown><script type="text/template">Slide A\n</script></section>' +
18+
'<section data-markdown><script type="text/template">Slide A\n</script></section>' +
2119
'<section >' +
2220
'<section data-markdown><script type="text/template">\nSlide B\n</script></section>' +
2321
'<section data-markdown><script type="text/template">\nSlide C</script></section>' +
@@ -29,8 +27,7 @@ test('should render slides split by custom separators', () => {
2927
const actual = slidify('Slide A\n\n\nSlide B\n\nSlide C', { separator: '\n\n\n', verticalSeparator: '\n\n' });
3028
assert.equal(
3129
actual,
32-
'' +
33-
'<section data-markdown><script type="text/template">Slide A</script></section>' +
30+
'<section data-markdown><script type="text/template">Slide A</script></section>' +
3431
'<section >' +
3532
'<section data-markdown><script type="text/template">Slide B</script></section>' +
3633
'<section data-markdown><script type="text/template">Slide C</script></section>' +
@@ -42,16 +39,16 @@ test('should render speaker notes', () => {
4239
const actual = slidify('Slide A\n\nNote: test');
4340
assert.equal(
4441
actual,
45-
'<section data-markdown><script type="text/template">Slide A\n\n<aside class="notes"><p>test</p>\n</aside></script></section>'
42+
'<section data-markdown>' +
43+
'<script type="text/template">Slide A\n\n<aside class="notes"><p>test</p>\n</aside></script></section>'
4644
);
4745
});
4846

4947
test('should ignore comments (e.g. custom slide attributes)', () => {
5048
const actual = slidify('Slide A\n\n---\n\n<!-- .slide: data-background="./image1.png" -->\nSlide B');
5149
assert.equal(
5250
actual,
53-
'' +
54-
'<section data-markdown><script type="text/template">Slide A\n</script></section>' +
51+
'<section data-markdown><script type="text/template">Slide A\n</script></section>' +
5552
'<section data-markdown><script type="text/template">\n<!-- .slide: data-background="./image1.png" -->\nSlide B</script></section>'
5653
);
5754
});

0 commit comments

Comments
 (0)