File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -25,3 +25,12 @@ export const compressLineBreaks = (s: string) => {
2525 }
2626 return s ;
2727} ;
28+
29+ const TOO_MANY_SPACES = / { 3 } / g;
30+ const APPROPRIATE_SPACES = " " ;
31+ export const compressSpaces = ( s : string ) => {
32+ while ( TOO_MANY_SPACES . test ( s ) ) {
33+ s = s . replaceAll ( TOO_MANY_SPACES , APPROPRIATE_SPACES ) ;
34+ }
35+ return s ;
36+ } ;
Original file line number Diff line number Diff line change @@ -8,7 +8,11 @@ import {
88 StoredMessage ,
99 getJobPosts ,
1010} from "./features/jobs-moderation/job-mod-helpers.js" ;
11- import { compressLineBreaks , simplifyString } from "./helpers/string.js" ;
11+ import {
12+ compressSpaces ,
13+ compressLineBreaks ,
14+ simplifyString ,
15+ } from "./helpers/string.js" ;
1216import { constructDiscordLink } from "./helpers/discord.js" ;
1317import { reactibotApiKey } from "./helpers/env.js" ;
1418
@@ -275,7 +279,9 @@ const renderPost = (post: StoredMessage): RenderedPost => {
275279 tags : post . tags ,
276280 type : post . type ,
277281 createdAt : post . createdAt ,
278- description : renderMdToHtml ( compressLineBreaks ( post . description ) ) ,
282+ description : renderMdToHtml (
283+ compressLineBreaks ( compressSpaces ( post . description ) ) ,
284+ ) ,
279285 messageLink : constructDiscordLink ( post . message ) ,
280286 reactions : post . message . reactions . cache . map ( ( r ) => [
281287 r . emoji . name ?? "☐" ,
You can’t perform that action at this time.
0 commit comments