Adding linebreaks when using bodyText

23 views
Skip to first unread message

skogkatt

unread,
Oct 24, 2024, 4:28:17 AMOct 24
to Guardian Open Platform API Forum
You can put the bodyText value in show-fields to get the unwrapped bodyText on lookup. I've been using regular expressions to handle things like periods and quotes to get the newlines, but the number of cases is overwhelming and I need help. How would be the smartest way to handle newlines?

Emily Bourke

unread,
Oct 24, 2024, 4:50:14 AMOct 24
to Guardian Open Platform API Forum
Hi,

I’m afraid I don’t have any tricks for this! It does strike me though that it’d probably be easier to start with the body field, and then you could remove "<p>" tags and replace "</p>" tags with a newline.

Best wishes,
Emily
Reply all
Reply to author
Forward
0 new messages