mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
feat: add minor pre-processing step to better handle header elements in incoming html
This commit is contained in:
@@ -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",
|
||||||
|
|||||||
@@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user