Skip to content

Commit

Permalink
feat: re-escape  
Browse files Browse the repository at this point in the history
  • Loading branch information
holtwick committed Dec 15, 2023
1 parent e742ca5 commit 49753b5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/encoding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export function escapeHTML(text: string) {
.replace(/>/g, '>')
.replace(/'/g, ''')
.replace(/"/g, '"')
.replace(/\xA0/g, ' ')
.replace(/\xAD/g, '­')
}

// encode(text, {
Expand Down
8 changes: 8 additions & 0 deletions src/manipulate.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ describe('manipulate', () => {
it('should manipulate html', () => {
const html = `<!DOCTYPE html>
<html lang="de">
<head>
<title>Some - More!</title>
</head>
<body>
<p class="img-wrapper"><img src="/assets/ocr@2x-97ede361.png" alt="" width="621" height="422"></p>
This is &nbsp; spaaace!
</body>
</html>
`
Expand All @@ -22,8 +26,12 @@ describe('manipulate', () => {
expect(rhtml).toMatchInlineSnapshot(`
"<!DOCTYPE html>
<html lang="de">
<head>
<title>Some - More!</title>
</head>
<body>
<p class="img-wrapper"><img src="/assets/ocr@2x-97ede361.png" alt="" width="621" height="422"></p>
This is &nbsp; spaaace!
</body>
</html>
"
Expand Down
1 change: 0 additions & 1 deletion src/vdom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,6 @@ export class VDocument extends VDocumentFragment {
let content = super.render(h)
if (this.docType)
content = this.docType.render() + content

return content
}
}
Expand Down

0 comments on commit 49753b5

Please sign in to comment.