pretty printing HTML output (for nice git diffs)

This commit is contained in:
azivner
2017-12-03 09:19:48 -05:00
parent ddd216c92e
commit 41f089b3f4
3 changed files with 11 additions and 1 deletions

View File

@@ -6,6 +6,7 @@ const rimraf = require('rimraf');
const fs = require('fs');
const sql = require('../../services/sql');
const data_dir = require('../../services/data_dir');
const html = require('html');
router.get('/:noteId/to/:directory', async (req, res, next) => {
const noteId = req.params.noteId;
@@ -36,7 +37,7 @@ async function exportNote(noteTreeId, dir) {
const pos = (noteTree.note_pos + '').padStart(4, '0');
fs.writeFileSync(dir + '/' + pos + '-' + note.note_title + '.html', note.note_text);
fs.writeFileSync(dir + '/' + pos + '-' + note.note_title + '.html', html.prettyPrint(note.note_text, {indent_size: 2}));
const children = await sql.getResults("SELECT * FROM notes_tree WHERE note_pid = ? AND is_deleted = 0", [note.note_id]);