Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
poc-api
Project
Project
Details
Activity
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
poc
poc-api
Commits
0b33fb3c
Commit
0b33fb3c
authored
Mar 10, 2025
by
alex yao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:内容导出-优化换行问题
parent
e8ea5053
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
ContentReportRestImpl.java
...va/cn/com/poc/expose/rest/impl/ContentReportRestImpl.java
+7
-1
No files found.
src/main/java/cn/com/poc/expose/rest/impl/ContentReportRestImpl.java
View file @
0b33fb3c
...
...
@@ -22,6 +22,8 @@ import org.springframework.stereotype.Component;
import
javax.annotation.Resource
;
import
java.io.*
;
import
java.nio.charset.StandardCharsets
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
/**
* @author alex.yao
...
...
@@ -59,9 +61,13 @@ public class ContentReportRestImpl implements ContentReportRest {
}
private
String
convertMarkdownToHtml
(
String
markdown
)
{
Pattern
p
=
Pattern
.
compile
(
"(\r?\n(\\s*\r?\n)+)"
);
Matcher
m
=
p
.
matcher
(
markdown
);
String
result
=
m
.
replaceAll
(
"\r\n"
);
Parser
parser
=
Parser
.
builder
().
build
();
HtmlRenderer
renderer
=
HtmlRenderer
.
builder
().
build
();
Document
document
=
parser
.
parse
(
markdown
);
Document
document
=
parser
.
parse
(
result
);
return
renderer
.
render
(
document
);
}
...
...
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