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 duplicated content and indentation in hide-markdown-diff
#4052
Fix duplicated content and indentation in hide-markdown-diff
#4052
Conversation
It's around the end:
The first part of the quote block gets duplicated because it's not marked as deleted. Here's a minimal reproducible example:
This will give the following diff:
|
for (const changedBlockquote of select.all('.show-preview .changed > .changed_tag[data-before-tag="blockquote"]')) { | ||
changedBlockquote.parentElement!.classList.add('ml-3'); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the end I had to rely on some JS to fix the missing indentation issue.
At first I applied a margin on any siblings of .changed_tag[data-before-tag="blockquote"]
but this causes issues with inline <ins>
elements, so it has to be applied to the diff block wrapper.
Needs a little more work, I think. Right side: this PR
|
hide-markdown-diff
hide-markdown-diff
Actually since I switched to the CSS-only solution the style doesn't change anymore. Anyway, I thought it made more sense to hide the duplicated content only when hiding the whole diff — otherwise we're modifying the native GH behavior even when the feature isn't toggled on, which isn't really what's advertised. |
Since
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to work correctly
hide-markdown-diff
hide-markdown-diff
Fixes #4035
Test URLs
Example: https://github.com/sindresorhus/refined-github/edit/main/readme.md
For a more thorough testing:
Create a Markdown file with the following content:
Then edit it and replace its content with:
This PR:
hide-markdown-diff
#4052 (comment) for a minimal reproducible example)