mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-03 09:52:24 -06:00
jiggle the opts
This commit is contained in:
parent
c8556cfd97
commit
2497a4d596
1 changed files with 16 additions and 10 deletions
|
|
@ -96,20 +96,26 @@ func (f *Formatter) fromMarkdown(
|
||||||
input string,
|
input string,
|
||||||
) *FormatResult {
|
) *FormatResult {
|
||||||
var (
|
var (
|
||||||
result = new(FormatResult)
|
result = new(FormatResult)
|
||||||
rendererOptions = []renderer.Option{
|
opts []renderer.Option
|
||||||
|
)
|
||||||
|
|
||||||
|
if basic {
|
||||||
|
// Don't allow raw HTML tags,
|
||||||
|
// markdown syntax only.
|
||||||
|
opts = []renderer.Option{
|
||||||
html.WithXHTML(),
|
html.WithXHTML(),
|
||||||
html.WithHardWraps(),
|
html.WithHardWraps(),
|
||||||
}
|
}
|
||||||
)
|
} else {
|
||||||
|
opts = []renderer.Option{
|
||||||
|
html.WithXHTML(),
|
||||||
|
html.WithHardWraps(),
|
||||||
|
|
||||||
if !basic {
|
// Allow raw HTML tags, we
|
||||||
// Allow raw HTML. We sanitize
|
// sanitize at the end anyway.
|
||||||
// at the end so this is OK.
|
|
||||||
rendererOptions = append(
|
|
||||||
rendererOptions,
|
|
||||||
html.WithUnsafe(),
|
html.WithUnsafe(),
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Instantiate goldmark parser for
|
// Instantiate goldmark parser for
|
||||||
|
|
@ -117,7 +123,7 @@ func (f *Formatter) fromMarkdown(
|
||||||
// to add hashtag/mention links.
|
// to add hashtag/mention links.
|
||||||
md := goldmark.New(
|
md := goldmark.New(
|
||||||
goldmark.WithRendererOptions(
|
goldmark.WithRendererOptions(
|
||||||
rendererOptions...,
|
opts...,
|
||||||
),
|
),
|
||||||
goldmark.WithExtensions(
|
goldmark.WithExtensions(
|
||||||
&customRenderer{
|
&customRenderer{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue