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

Keep whitespaces at the extremities of codeblocks #444

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

n-peugnet
Copy link
Contributor

This is an old commit I forgot to send, as a follow-up to #387

Now that codeblocks tokens are correctly parsed, there is no need anymore for parsing its content and then extracting its plaintext version. This allows to save some computation and to preserve the whitespaces at the beginning and end of a codeblock.

Previously, messages containing only an empty codeblock where not displayed. Now the text of the codeblock defaults to '\n' so the message is always displayed.

Now that codeblocks tokens are correctly parsed, there is no need anymore
for parsing its content and then extracting its plaintext version.
This allows to save some computation and to preserve the whitespaces at
the beginning and end of a codeblock.

Previously, messages containing only an empty codeblock where not
displayed. Now the text of the codeblock defaults to '\n' so the message
is always displayed.
@n-peugnet n-peugnet marked this pull request as draft October 30, 2023 10:00
@tulir
Copy link
Owner

tulir commented Oct 30, 2023

Looks a bit sus since code blocks can contain HTML 🤔

@n-peugnet
Copy link
Contributor Author

n-peugnet commented Oct 30, 2023

Looks a bit sus since code blocks can contain HTML 🤔

I'll check again, as I don't exactly remember why I made this commit like this (that's why I marked this PR as draft). But from my limited testing, HTML in code block seems to be handled by parser.syntaxHighlight()

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

Successfully merging this pull request may close these issues.

2 participants