feat: add minor pre-processing step to better handle header elements in incoming html

This commit is contained in:
Julian Lam
2025-09-05 13:11:52 -04:00
parent 2de200b311
commit 15f9fbaa5c
2 changed files with 4 additions and 1 deletions

View File

@@ -120,6 +120,7 @@
"pg-cursor": "2.15.3", "pg-cursor": "2.15.3",
"postcss": "8.5.6", "postcss": "8.5.6",
"postcss-clean": "1.2.0", "postcss-clean": "1.2.0",
"pretty": "^2.0.0",
"progress-webpack-plugin": "1.0.16", "progress-webpack-plugin": "1.0.16",
"prompt": "1.3.0", "prompt": "1.3.0",
"redis": "5.8.2", "redis": "5.8.2",

View File

@@ -3,6 +3,7 @@
const winston = require('winston'); const winston = require('winston');
const nconf = require('nconf'); const nconf = require('nconf');
const tokenizer = require('sbd'); const tokenizer = require('sbd');
const pretty = require('pretty');
const db = require('../database'); const db = require('../database');
const batch = require('../batch'); const batch = require('../batch');
@@ -156,7 +157,8 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => {
// mainPid ok to leave as-is // mainPid ok to leave as-is
if (!title) { if (!title) {
const sentences = tokenizer.sentences(content || sourceContent, { sanitize: true, newline_boundaries: true }); const prettified = pretty(content || sourceContent);
const sentences = tokenizer.sentences(prettified, { sanitize: true, newline_boundaries: true });
title = sentences.shift(); title = sentences.shift();
} }