mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-24 14:12:40 +00:00
Fix title issue (#1251)
* Maximum title length set to 100 characters.
* Reverse unnecessary change that was incorrectly included in previous commit.
* Reduced code change to one addition on a single line.
* Revert "Reduced code change to one addition on a single line."
This reverts commit 2a355cf115.
* Use newer syntax to shorten
Co-authored-by: Trevor Buckner <calculuschild@gmail.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
module.exports = {
|
||||
root : true,
|
||||
parserOptions : {
|
||||
ecmaVersion : 9,
|
||||
ecmaVersion : 2021,
|
||||
sourceType : 'module',
|
||||
ecmaFeatures : {
|
||||
jsx : true
|
||||
|
||||
@@ -11,9 +11,12 @@ const Markdown = require('../shared/naturalcrit/markdown.js');
|
||||
// });
|
||||
// };
|
||||
|
||||
const MAX_TITLE_LENGTH = 100;
|
||||
|
||||
const getGoodBrewTitle = (text)=>{
|
||||
const tokens = Markdown.marked.lexer(text);
|
||||
return title = (tokens.find((token)=>token.type == 'heading' || token.type == 'paragraph') || { text: 'No Title' }).text;
|
||||
return (tokens.find((token)=>token.type == 'heading' || token.type == 'paragraph')?.text || 'No Title')
|
||||
.slice(0, MAX_TITLE_LENGTH);
|
||||
};
|
||||
|
||||
const newBrew = (req, res)=>{
|
||||
|
||||
Reference in New Issue
Block a user