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

code blocks break line has been deleted #697

Open
ccpwcn opened this issue Jul 21, 2022 · 0 comments
Open

code blocks break line has been deleted #697

ccpwcn opened this issue Jul 21, 2022 · 0 comments

Comments

@ccpwcn
Copy link

ccpwcn commented Jul 21, 2022

my markdown:

```java
public interface List<E> extends Collection<E> {
    // 内容省略
}

my go code:
```golang
input := []byte(article.Content)
unsafe := blackfriday.Run(input, blackfriday.WithExtensions(blackfriday.CommonExtensions))
p := bluemonday.UGCPolicy()
p.AllowAttrs("class").Matching(regexp.MustCompile("^language-[a-zA-Z0-9]+$")).OnElements("code")
output := string(p.SanitizeBytes(unsafe))

my html text:

<code>java
public interface List&lt;E&gt; extends Collection&lt;E&gt; {
    // 内容省略
}
</code>

show in browser:
code-block-one-line

all line and breaks has been deleted, expected, it will show look like this:

public interface List<E> extends Collection<E> {
    // 内容省略
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant