Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tech
dify
Commits
81c5a21b
Unverified
Commit
81c5a21b
authored
Feb 19, 2024
by
Yash_1124
Committed by
GitHub
Feb 19, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FEAT: add image styling in markdown (#2441)
Co-authored-by:
crazywoola
<
427733928@qq.com
>
parent
61e4bbab
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
0 deletions
+31
-0
markdown.tsx
web/app/components/base/markdown.tsx
+31
-0
No files found.
web/app/components/base/markdown.tsx
View file @
81c5a21b
...
@@ -143,6 +143,37 @@ export function Markdown(props: { content: string; className?: string }) {
...
@@ -143,6 +143,37 @@ export function Markdown(props: { content: string; className?: string }) {
</
code
>
</
code
>
)
)
},
},
img
({
src
,
alt
,
...
props
})
{
return
(
// eslint-disable-next-line @next/next/no-img-element
<
img
src=
{
src
}
alt=
{
alt
}
width=
{
250
}
height=
{
250
}
className=
"max-w-full h-auto align-middle border-none rounded-lg shadow-md hover:shadow-lg transition-shadow duration-300 ease-in-out mt-2 mb-2"
{
...
props
}
/>
)
},
p
:
(
paragraph
)
=>
{
const
{
node
}:
any
=
paragraph
if
(
node
.
children
[
0
].
tagName
===
'img'
)
{
const
image
=
node
.
children
[
0
]
return
(
// eslint-disable-next-line @next/next/no-img-element
<
img
src=
{
image
.
properties
.
src
}
width=
{
250
}
height=
{
250
}
className=
"max-w-full h-auto align-middle border-none rounded-lg shadow-md hover:shadow-lg transition-shadow duration-300 ease-in-out mt-2 mb-2"
alt=
{
image
.
properties
.
alt
}
/>
)
}
return
<
p
>
{
paragraph
.
children
}
</
p
>
},
}
}
}
}
linkTarget=
'_blank'
linkTarget=
'_blank'
>
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment