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

helpers: Support complex HTML in plainify #9410

Closed

Conversation

roointan
Copy link
Contributor

Support complex HTML in plainify by replacing the simple HTML sripper with the sanitizer functionality of the bluemonday library, with a strict policy (to strip all HTML elements and their attributes)

Fixes #9199

Support complex HTML in plainify by replacing the simple HTML sripper with the sanitizer functionality of the bluemonday library, with a strict policy (to strip all HTML elements and their attributes)

Fixes gohugoio#9199
@bep
Copy link
Member

bep commented May 25, 2022

Bluemonday is a HTML sanitizer. That is about removing unwanted/unsafe HTML -- this is about making it into plain text, which I would hope should be a simpler task not requiring that many new dependencies. I'm closing this for now, but thanks.

@bep bep closed this May 25, 2022
@bep
Copy link
Member

bep commented May 25, 2022

Reopen, in case i don't find anything simpler.

@bep bep reopened this May 25, 2022
@bep bep mentioned this pull request May 25, 2022
bep added a commit to bep/hugo that referenced this pull request May 25, 2022
This commit replaces the main part of `helpers.

```bash
BenchmarkStripHTMLOld-10    	  680316	      1764 ns/op	     728 B/op	       4 allocs/op
BenchmarkStripHTMLNew-10    	  384520	      3099 ns/op	    2089 B/op	      10 allocs/op
```

Fixes gohugoio#9419
Fixes gohugoio#9909
Closes gohugoio#9410
bep added a commit to bep/hugo that referenced this pull request May 25, 2022
This commit replaces the main part of `helpers.StripHTML` with Go's implementation in its html/template package.

It's a little slower, but correctness is more important:

```bash
BenchmarkStripHTMLOld-10    	  680316	      1764 ns/op	     728 B/op	       4 allocs/op
BenchmarkStripHTMLNew-10    	  384520	      3099 ns/op	    2089 B/op	      10 allocs/op
```

Fixes gohugoio#9419
Fixes gohugoio#9909
Closes gohugoio#9410
bep added a commit to bep/hugo that referenced this pull request May 25, 2022
This commit replaces the main part of `helpers.StripHTML` with Go's implementation in its html/template package.

It's a little slower, but correctness is more important:

```bash
BenchmarkStripHTMLOld-10    	  680316	      1764 ns/op	     728 B/op	       4 allocs/op
BenchmarkStripHTMLNew-10    	  384520	      3099 ns/op	    2089 B/op	      10 allocs/op
```

Fixes gohugoio#9199
Fixes gohugoio#9909
Closes gohugoio#9410
bep added a commit to bep/hugo that referenced this pull request May 25, 2022
This commit replaces the main part of `helpers.StripHTML` with Go's implementation in its html/template package.

It's a little slower, but correctness is more important:

```bash
BenchmarkStripHTMLOld-10    	  680316	      1764 ns/op	     728 B/op	       4 allocs/op
BenchmarkStripHTMLNew-10    	  384520	      3099 ns/op	    2089 B/op	      10 allocs/op
```

Fixes gohugoio#9199
Fixes gohugoio#9909
Closes gohugoio#9410
@bep bep closed this in #9923 May 25, 2022
bep added a commit that referenced this pull request May 25, 2022
This commit replaces the main part of `helpers.StripHTML` with Go's implementation in its html/template package.

It's a little slower, but correctness is more important:

```bash
BenchmarkStripHTMLOld-10    	  680316	      1764 ns/op	     728 B/op	       4 allocs/op
BenchmarkStripHTMLNew-10    	  384520	      3099 ns/op	    2089 B/op	      10 allocs/op
```

Fixes #9199
Fixes #9909
Closes #9410
@roointan roointan deleted the fix-breaking-plainify-function branch May 25, 2022 19:07
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Symbol '>' breaks plainify function
2 participants