Skip to content
Open
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
17 changes: 15 additions & 2 deletions src-tauri/src/structs/article.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,22 @@ impl From<Entry> for Article {
None => String::from("No title found, please report this issue."),
};
let content = match entry.content {
Some(c) => c.body.unwrap(),
Some(c) => c.body.unwrap()
.replace('&', "&amp;")
.replace('<', "&lt;")
.replace('>', "&gt;")
.replace('\n', "<br>\n")
.replace('\t', "&nbsp;&nbsp;&nbsp;&nbsp;"),
None => match entry.summary {
Some(s) => s.content,
Some(s) => {
// Convert plain text to HTML preserving formatting
s.content
.replace('&', "&amp;")
.replace('<', "&lt;")
.replace('>', "&gt;")
.replace('\n', "<br>\n")
.replace('\t', "&nbsp;&nbsp;&nbsp;&nbsp;")
},
None => String::from("No content found, please report this issue."),
},
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/utils/SanitizeHTML.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default function SanitizeHTML({ html, limit = 0 }: SanitizeHTMLProps) {

return limit === 0
? treated
: `${treated.slice(0, limit).replaceAll('\n', ' ').trim()}...`;
: `${treated.slice(0, limit).trim()}...`;
}, [html, limit]);

return (
Expand Down