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: Correct the default display of elements like img in Markdown preview to be inline-block #13

Merged
merged 2 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 26 additions & 6 deletions app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 19 additions & 8 deletions app/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/src/components/previews/MarkdownPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const MarkdownPreview: FC<{
return (
<div>
{standalone && <BasicInfoPanel file={file}></BasicInfoPanel>}
<div className="border-t border-gray-900/10 bg-white bg-opacity-80 p-2 shadow-sm backdrop-blur-md dark:border-gray-500/30 dark:bg-gray-900 rounded !bg-opacity-50">
<div className="border-t border-gray-900/10 bg-white p-2 shadow-sm backdrop-blur-md dark:border-gray-500/30 dark:bg-gray-900 rounded !bg-opacity-50">
<div className="markdown-body">
{/* Using rehypeRaw to render HTML inside Markdown is potentially dangerous, use under safe environments. (#18) */}
<ReactMarkdown
Expand Down
10 changes: 5 additions & 5 deletions app/src/styles/markdown-github.css
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@

.markdown-body strong {
font-weight: inherit;
font-weight: bolder;
}

.markdown-body h1 {
Expand Down Expand Up @@ -778,7 +777,6 @@
.markdown-body img {
max-width: 100%;
box-sizing: initial;
background-color: #fff;
}

.markdown-body img[align='right'] {
Expand Down Expand Up @@ -988,6 +986,11 @@
vertical-align: middle;
}

.markdown-body img, svg, video, canvas, audio, iframe, embed, object {
display: inline-block;
vertical-align: middle;
}

@media (prefers-color-scheme: dark) {
.markdown-body {
/* color: #c9d1d9; */
Expand Down Expand Up @@ -1139,9 +1142,6 @@
.markdown-body table tr:nth-child(2n) {
background-color: #161b22;
}
.markdown-body img {
background-color: #0d1117;
}
.markdown-body code {
background-color: rgba(240, 246, 252, 0.15);
}
Expand Down
Loading