Skip to content

Commit

Permalink
Truncate long abstracts
Browse files Browse the repository at this point in the history
I can't see anything in the Slack docs, but it seems that 'mrkdwn' objects have a limit of 3,000 characters.
  • Loading branch information
thewilkybarkid committed Jan 16, 2025
1 parent 21b1710 commit 8121f59
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@jsr:registry=https://npm.jsr.io
audit = false
engine-strict = true
fund = false
7 changes: 7 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
},
"type": "module",
"dependencies": {
"@arendjr/text-clipper": "npm:@jsr/arendjr__text-clipper@^3.0.0",
"@effect/platform": "0.58.20",
"@effect/platform-node": "^0.53.19",
"@effect/schema": "^0.68.17",
Expand Down
3 changes: 2 additions & 1 deletion src/ReviewRequest.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import clip from '@arendjr/text-clipper'
import { Schema } from '@effect/schema'
import { Array, Context, Data, Effect, Exit, Match, String, pipe } from 'effect'
import { decode } from 'html-entities'
Expand Down Expand Up @@ -47,7 +48,7 @@ const threadToSlackBlocks = (
post.text,
String.replaceAll(
'[ABSTRACT]',
`> ${decode(striptags(preprint.abstract)).replaceAll(/(?:\r\n|\r|\n)+/gm, ' ')}`,
`> ${clip(decode(striptags(preprint.abstract)).replaceAll(/(?:\r\n|\r|\n)+/gm, ' '), 2_900)}`,
),
slackifyMarkdown,
String.trim,
Expand Down

0 comments on commit 8121f59

Please sign in to comment.