pfwr 0.5.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +3 -3
- package/bin/cli.js +16 -8
- package/bin/template.md +30 -0
- package/dist/index.js +98 -28269
- package/package.json +38 -31
- package/CHANGELOG.md +0 -47
- package/docs/screenshot.png +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Nico Rehwaldt
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/nikku/pfwr/actions?query=workflow%3ACI)
|
|
4
4
|
|
|
5
|
-
Turns your [Markdown file](https://github.com/nikku/pfwr/blob/main/README.md#example) into [a beautiful HTML slide deck](https://cdn.statically.io/gh/nikku/pfwr/v0.
|
|
5
|
+
Turns your [Markdown file](https://github.com/nikku/pfwr/blob/main/README.md#example) into [a beautiful HTML slide deck](https://cdn.statically.io/gh/nikku/pfwr/v0.7.0/example/presentation.html). Batteries included.
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
## Introduction
|
|
9
9
|
|
|
10
|
-
[](https://cdn.statically.io/gh/nikku/pfwr/v0.
|
|
10
|
+
[](https://cdn.statically.io/gh/nikku/pfwr/v0.7.0/example/presentation.html)
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
## Usage
|
|
@@ -74,7 +74,7 @@ Convert the file to an HTML file:
|
|
|
74
74
|
pfwr presentation.md presentation.html
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
-
Open [the slide deck](https://cdn.statically.io/gh/nikku/pfwr/v0.
|
|
77
|
+
Open [the slide deck](https://cdn.statically.io/gh/nikku/pfwr/v0.7.0/example/presentation.html) in your favorite browser.
|
|
78
78
|
|
|
79
79
|
|
|
80
80
|
## Security Considerations
|
package/bin/cli.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { pfwr } from '../dist/index.js';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import path from 'path';
|
|
6
|
+
import fs from 'fs';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
import mri from 'mri';
|
|
9
|
+
import opener from 'opener';
|
|
10
|
+
|
|
11
|
+
import pkg from '../package.json' assert { type: "json" };
|
|
10
12
|
|
|
11
13
|
const argv = process.argv.slice(2);
|
|
12
14
|
|
|
@@ -20,7 +22,7 @@ const args = mri(argv, {
|
|
|
20
22
|
});
|
|
21
23
|
|
|
22
24
|
if (args.version) {
|
|
23
|
-
console.log(
|
|
25
|
+
console.log(pkg.version);
|
|
24
26
|
|
|
25
27
|
process.exit(0);
|
|
26
28
|
}
|
|
@@ -55,14 +57,20 @@ const outputFile = args._[1] || defaultOutput(inputFile);
|
|
|
55
57
|
async function run() {
|
|
56
58
|
const t = Date.now();
|
|
57
59
|
|
|
60
|
+
if (!fs.existsSync(inputFile)) {
|
|
61
|
+
console.log('Created %s', inputFile);
|
|
62
|
+
|
|
63
|
+
fs.copyFileSync(__dirname + '/template.md', inputFile);
|
|
64
|
+
}
|
|
65
|
+
|
|
58
66
|
const input = {
|
|
59
67
|
path: inputFile,
|
|
60
|
-
|
|
68
|
+
value: fs.readFileSync(inputFile, 'utf8')
|
|
61
69
|
};
|
|
62
70
|
|
|
63
71
|
return pfwr(input).then(output => {
|
|
64
72
|
|
|
65
|
-
fs.writeFileSync(outputFile, output.
|
|
73
|
+
fs.writeFileSync(outputFile, output.value, 'utf8');
|
|
66
74
|
|
|
67
75
|
console.log('Transformed %s -> %s in %sms', inputFile, outputFile, (Date.now() - t));
|
|
68
76
|
});
|
package/bin/template.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Some Title
|
|
3
|
+
description: A human readable description
|
|
4
|
+
author: Fred the Duck
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Some Title
|
|
8
|
+
|
|
9
|
+
#### Sub title
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Add Content
|
|
14
|
+
|
|
15
|
+
*Some* _Markdown_ **!**
|
|
16
|
+
|
|
17
|
+
`code`
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Add Lists
|
|
22
|
+
|
|
23
|
+
* bullet points
|
|
24
|
+
* are supported, too
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Thanks
|
|
29
|
+
|
|
30
|
+
# :heart:
|