Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove trailing newlines in body #125

Closed
xethos84 opened this issue Jun 25, 2023 · 3 comments
Closed

Remove trailing newlines in body #125

xethos84 opened this issue Jun 25, 2023 · 3 comments
Assignees
Milestone

Comments

@xethos84
Copy link

Whenever a message is sent, a newline is appended. This breaks some functions, like interacting with Bridge bots for things like Google Chat. The bot expects the body to exactly match command, and fails when the body is command\n. I've noticed the newline is also appended to the body of my regular messages, not just single-word ones (though it doesn't break messages in rooms as far as I've noticed).

Hopefully messages can be sent without the extraneous \n being added to every single one.

@ulyssa ulyssa self-assigned this Jun 25, 2023
@ulyssa ulyssa added this to the v0.0.8 milestone Jun 25, 2023
@ulyssa ulyssa changed the title Extraneous newline in body Remove trailing newlines in body Jul 1, 2023
ulyssa added a commit that referenced this issue Jul 1, 2023
@ulyssa ulyssa closed this as completed Jul 1, 2023
@ulyssa ulyssa mentioned this issue Jul 8, 2023
@vacuumbeef
Copy link

I'm on 0.0.8 and every message I send has an additional line in the end. I guess it's relevant to this issue?
image

@konomikitten
Copy link

I'm still having this problem, installed with cargo and on version 0.0.9. Contacts I talk to say my messages have an extra newline on the end.

@obfusk
Copy link

obfusk commented May 14, 2024

It seems like the newline is added by the conversion to markdown, so you'd need to trim the result of that, not its input:

use comrak::{markdown_to_html, Options};
assert_eq!(markdown_to_html("Hello, **世界**!", &Options::default()),
           "<p>Hello, <strong>世界</strong>!</p>\n");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants