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

fix: Markdown paragraph spacing issue in recipe notes #4687

Draft
wants to merge 3 commits into
base: mealie-next
Choose a base branch
from

Conversation

cnorteye
Copy link

@cnorteye cnorteye commented Dec 6, 2024

What type of PR is this?

  • bug

What this PR does / why we need it:

This PR addresses an issue where single-line breaks in recipe notes caused incorrect paragraph spacing. The following changes were made:

Added a preprocessMarkdown function to RecipeNotes.vue to convert single line breaks into double line breaks for proper Markdown rendering.
Updated SafeMarkdown usage in RecipeNotes.vue to preprocess text before rendering.
These changes ensure that paragraphs are spaced correctly when rendering recipe notes.

Before:
Screenshot 2024-12-02 at 10 58 28 PM
Screenshot 2024-12-02 at 10 58 14 PM

After:
Screenshot 2024-12-02 at 10 51 27 PM
Screenshot 2024-12-02 at 10 51 41 PM
-->

Which issue(s) this PR fixes:

Fixes #2854
Fixes #2846

Special notes for your reviewer:

This PR is a continuation of #4664 which I mistakenly closed while trying to make some changes based on reviewers notes.

Testing

Since this was a UI improvement, I just observed the changes.

@github-actions github-actions bot added the bugfix label Dec 6, 2024
@cnorteye cnorteye marked this pull request as ready for review December 8, 2024 06:18
Copy link
Collaborator

@michael-genson michael-genson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! One issue I've run into is that this breaks tables, lists, and other elements that rely on line breaks. For instance, here's a table before the change:

image

And after:

image

Markdown:

| Command | Description |
| --- | --- |
| git status | List all new or modified files |
| git diff | Show file differences that haven't been staged |

Maybe we need to only target double line breaks? (e.g. \n\n). I'd also be open to finding an alternative package to convert markdown to HTML that isn't this one (maybe another package handles line breaks better?).

@Kuchenpirat
Copy link
Collaborator

Kuchenpirat commented Dec 12, 2024

I had looked at this a few days ago and came to the same comclusion as michael, i also checked the live demo of the vue markdown package.
There the markdown is rendered as expected. I did not have time to look too deep into this but it might not be simply an issue with the package we are using.

Additionally vue-markdown has a prerender prop we might want to use. Just looks a bit cleaner.

@Kuchenpirat Kuchenpirat marked this pull request as draft January 15, 2025 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants