Skip to content

Commit ef43717

Browse files
committed
Don't prettify output
Was leading to whitespace problems
1 parent a37873e commit ef43717

File tree

5 files changed

+6
-19
lines changed

5 files changed

+6
-19
lines changed

changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Changelog
22

33
## Next
4+
- Changed output to no longer be prettified.
5+
- Fixed spacing issues resulting from output prettification.
46
- Fixed links not being automatically capitalised.
57
- Fixed named references not working.
68

package-lock.json

Lines changed: 1 addition & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@
4141
"dateformat": "^4.6.3",
4242
"dedent": "^1.5.3",
4343
"escape-html": "^1.0.3",
44-
"glob": "^8.1.0",
45-
"html-formatter": "^0.1.9"
44+
"glob": "^8.1.0"
4645
},
4746
"devDependencies": {
4847
"@types/dateformat": "^3.0.1",

src/compile.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import fs from 'fs';
22
import paths from 'path';
33
import glob from 'glob';
44
import dedent from 'dedent';
5-
const formatter = require('html-formatter'); // does not have type package
65

76
import { parse } from './parse';
87
import { Config, Result } from './common';
@@ -107,8 +106,8 @@ export function compile(dir: string = '.', config: Config = {}): void {
107106
if (!fs.existsSync(paths.dirname(outFilePath))) {
108107
fs.mkdirSync(paths.dirname(outFilePath));
109108
}
110-
const renderedHtml = formatter.render(html.replace(/(<\/\w+>) +(\S)/g, '$1&#32;$2'));
111-
fs.writeFileSync(outFilePath, frontMatter + '\n' + renderedHtml, 'utf8');
109+
const formattedHtml = html.replace(/\n[\n\s]+/g, '\n');
110+
fs.writeFileSync(outFilePath, frontMatter + '\n' + formattedHtml, 'utf8');
112111

113112
// Move images
114113
glob(imagesFolder + '/*', {}, (err, files) => {

src/wiki.css.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ a.external-link::after {content: '\1f855';}
2424
a.redlink {color: #d33;}
2525
a.redlink:visited {color: #b44;}
2626
27-
sup.refnote {margin-left: -5px;}
28-
2927
#page+toc {border: 1px solid #aab; padding: 8px; width: fit-content; background-color: #f8f8f8; font-size: 95%;}
3028
#page+toc-heading {display: block; text-align: center;}
3129
#page+toc ol {margin: 0 0 0 1.3em;}

0 commit comments

Comments
 (0)