Skip to content

Commit 19b63cd

Browse files
authored
Merge pull request #43 from sqrrrl/master
Major refactoring -- migrate to TypeScript, reorganize code
2 parents dccac4b + cb2238b commit 19b63cd

39 files changed

+3105
-2702
lines changed

.babelrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"presets": [
3+
"@babel/preset-typescript",
34
[
45
"@babel/preset-env",
56
{
@@ -8,5 +9,9 @@
89
}
910
}
1011
]
12+
],
13+
"plugins": [
14+
"@babel/proposal-class-properties",
15+
"@babel/proposal-object-rest-spread"
1116
]
1217
}

.eslintrc.json

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,32 @@
22
"env": {
33
"node": true
44
},
5+
"parser": "@typescript-eslint/parser",
56
"parserOptions": {
6-
"ecmaVersion": 8,
7-
"sourceType": "module"
7+
"ecmaVersion": 2018,
8+
"sourceType": "module"
89
},
9-
"extends": "eslint:recommended",
10+
"extends": [
11+
"plugin:@typescript-eslint/recommended",
12+
"prettier",
13+
"plugin:prettier/recommended",
14+
"prettier/@typescript-eslint"
15+
],
1016
"rules": {
11-
"indent": [
17+
"@typescript-eslint/explicit-function-return-type": [
1218
"error",
13-
4
19+
{
20+
"allowExpressions": true
21+
}
1422
],
15-
"linebreak-style": [
23+
"@typescript-eslint/no-unused-vars": [
1624
"error",
17-
"unix"
18-
],
19-
"quotes": [
20-
"error",
21-
"single"
22-
],
23-
"semi": [
24-
"error",
25-
"always"
25+
{
26+
"vars": "all",
27+
"args": "after-used",
28+
"ignoreRestSiblings": false
29+
}
2630
]
31+
2732
}
2833
}

.prettierrc.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
semi: true,
3+
trailingComma: 'all',
4+
singleQuote: true,
5+
printWidth: 120,
6+
tabWidth: 4,
7+
};

.travis.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
language: node_js
22
node_js:
3+
- 10
34
- 9
45
- 8
5-
- 7
6-
- 6
7-
- node

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
## (pending)
44

55
* Support local image upload (via file.io) and rasterization of SVG and TeX/MathML expressions
6-
* Allow custom layouts via markdown
6+
* Fix image alignment when included in a column
77
* Allow offsets for images
8+
* Allow custom layouts via markdown, copying from existing template. Note
9+
this changes the drive scope and requires reauthorization.
810
* Update dependencies
11+
* Migrate code to TypeScript
912

1013
## 0.4
1114

README.md

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,17 @@ are supported. For example, to use the github theme
295295
md2gslides slides.md --style github
296296
```
297297

298+
You can also apply additional style changes to the entire block, such as changing
299+
the font size:
300+
301+
<pre>
302+
### Hello World
303+
304+
```javascript
305+
console.log('Hello world');
306+
```{style="font-size: 36pt"}
307+
</pre>
308+
298309
### Tables
299310

300311
Tables are supported via
@@ -316,13 +327,59 @@ Dogs | 75 million
316327
Birds | 16 million
317328
</pre>
318329

330+
### Local images
331+
332+
Images referencing local paths temporarily uploaded and hosted to [file.io](https://file.io)
333+
334+
### Image rasterization
335+
336+
Slides can also include generated images, using `$$$` fenced blocks
337+
for the data. Currently supported generated images are math expression (TeX
338+
and MathML) as well as SVG
339+
340+
Using TeX:
341+
342+
<pre>
343+
# How about some math?
344+
345+
$$$ math
346+
\cos (2\theta) = \cos^2 \theta - \sin^2 \theta
347+
$$$
348+
</pre>
349+
350+
SVG
351+
352+
<pre>
353+
# Or some SVG?
354+
355+
$$$ svg
356+
&lt;svg xmlns="http://www.w3.org/2000/svg"
357+
xmlns:xlink="http://www.w3.org/1999/xlink"
358+
viewBox="0 0 48 48">
359+
&lt;defs>
360+
&lt;path id="a" d="M44.5 20H24v8.5h11.8C34.7 33.9 30.1 37 24 37c-7.2 0-13-5.8-13-13s5.8-13 13-13c3.1 0 5.9 1.1 8.1 2.9l6.4-6.4C34.6 4.1 29.6 2 24 2 11.8 2 2 11.8 2 24s9.8 22 22 22c11 0 21-8 21-22 0-1.3-.2-2.7-.5-4z"/>
361+
&lt;/defs>
362+
&lt;clipPath id="b">
363+
&lt;use xlink:href="#a" overflow="visible"/>
364+
&lt;/clipPath><path clip-path="url(#b)" fill="#FBBC05" d="M0 37V11l17 13z"/>
365+
&lt;path clip-path="url(#b)" fill="#EA4335" d="M0 11l17 13 7-6.1L48 14V0H0z"/>
366+
&lt;path clip-path="url(#b)" fill="#34A853" d="M0 37l30-23 7.9 1L48 0v48H0z"/>
367+
&lt;path clip-path="url(#b)" fill="#4285F4" d="M48 48L17 24l-4-3 35-10z"/>
368+
&lt;/svg>
369+
$$$
370+
</pre>
371+
372+
Like local images, generated images are temporarily served via file.io.
373+
374+
Pull requests for other image generators (e.g. mermaid, chartjs, etc.) are welcome!
375+
319376
## Reading from standard input
320377

321378
You can also pipe markdown into the tool by using `STDIN` as the file name.
322379

323380
## Contributing
324381

325-
With the exception of `/bin/md2gslides.js`, ES6 is used throughout and compiled
382+
With the exception of `/bin/md2gslides.js`, TypeScript is used throughout and compiled
326383
with [Babel](https://babeljs.io/). [Mocha](https://mochajs.org/) and [Chai](http://chaijs.com/)
327384
are used for testing.
328385

@@ -338,6 +395,12 @@ To run unit tests:
338395
npm run test
339396
```
340397

398+
To lint/format tests:
399+
400+
```sh
401+
npm run lint
402+
```
403+
341404
See [CONTRIBUTING](CONTRIBUTING.md) for additional terms.
342405

343406
## License

0 commit comments

Comments
 (0)