Trim leading whitespace-only lines (#7555)
This commit is contained in:
@@ -193,7 +193,12 @@ export async function post(
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function resolveRT(agent: BskyAgent, richtext: RichText) {
|
async function resolveRT(agent: BskyAgent, richtext: RichText) {
|
||||||
let rt = new RichText({text: richtext.text.trimEnd()}, {cleanNewlines: true})
|
const trimmedText = richtext.text
|
||||||
|
// Trim leading whitespace-only lines (but don't break ASCII art).
|
||||||
|
.replace(/^(\s*\n)+/, '')
|
||||||
|
// Trim any trailing whitespace.
|
||||||
|
.trimEnd()
|
||||||
|
let rt = new RichText({text: trimmedText}, {cleanNewlines: true})
|
||||||
await rt.detectFacets(agent)
|
await rt.detectFacets(agent)
|
||||||
|
|
||||||
rt = shortenLinks(rt)
|
rt = shortenLinks(rt)
|
||||||
|
|||||||
Reference in New Issue
Block a user