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

fix center-quote shortcode when config unsafe = false #160

Merged
merged 1 commit into from
Aug 27, 2022

Conversation

yureiita
Copy link
Contributor

when config unsafe = false, center-quote without markdown works but shortcode with markdown doesn't work.

the following doesn't work when unsafe = false:

{{% center-quote %}}
**hello** *world*
this is a center-quote shortcode example.
{{% /center-quote %}}

with this fix, the following works with markdown when unsafe = false:

{{< center-quote >}}
**hello** *world*
this is a center-quote shortcode example.
{{< /center-quote >}}

when config unsafe = false, center-quote without markdown works but shortcode with markdown doesn't work.

the following doesn't work when unsafe = false:
```
{{% center-quote %}}
**hello** *world*
this is a center-quote shortcode example.
{{% /center-quote %}}
```

with this fix, the following works with markdown when unsafe = false:
```
{{< center-quote >}}
**hello** *world*
this is a center-quote shortcode example.
{{< /center-quote >}}
```
@vercel
Copy link

vercel bot commented Jul 19, 2022

Someone is attempting to deploy a commit to a Personal Account owned by @Lruihao on Vercel.

@Lruihao first needs to authorize it.

Copy link
Member

@Lruihao Lruihao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what I do on purpose, I want to keep the difference between the two ways and leave the decision to the users.

see this commit bc41ae5

@Lruihao Lruihao added the wontfix This will not be worked on label Jul 19, 2022
@yureiita
Copy link
Contributor Author

I see, so the only solution is to use unsafe = true? because my config is unsafe = false.

{{< center-quote >}}
**hello** *world*
this is a center-quote shortcode example.
{{< /center-quote >}}

{{% center-quote %}}
**hello** *world*
this is a center-quote shortcode example.
{{% /center-quote %}}

the result of the above code when config unsafe = false is like the picture below:
image

@Lruihao

This comment was marked as outdated.

@Lruihao
Copy link
Member

Lruihao commented Jul 20, 2022

@yureiita When config unsafe = false, Hugo will omitte the raw HTML (<blockquote class="blockquote-center">...</blockquote>)

{{% center-quote %}}
**hello** *world*
this is a center-quote shortcode example.
{{% /center-quote %}}

image


However, using function .Page.RenderString will result in that original content not being output, so I haven't thought of a good solution yet.

@Lruihao Lruihao added bug Something isn't working and removed wontfix This will not be worked on labels Jul 20, 2022
@Lruihao Lruihao added this to the v0.2.15 milestone Jul 20, 2022
@Lruihao Lruihao self-assigned this Jul 20, 2022
@Lruihao
Copy link
Member

Lruihao commented Jul 20, 2022

@yureiita
FYI, think of a compromise solution, which is to create a center-quote.html under your project path layouts/shortcodes/ and fill in your changes.
In this way, the following works with markdown when unsafe = false:

{{< center-quote >}}
**hello** *world*
this is a center-quote shortcode example.
{{< /center-quote >}}

@yureiita
Copy link
Contributor Author

Alright thanks, I'll just do that. Thanks for the suggestion.

@Lruihao Lruihao modified the milestones: v0.2.15, v0.2.16 Aug 3, 2022
@Lruihao
Copy link
Member

Lruihao commented Aug 27, 2022

This is what I do on purpose, I want to keep the difference between the two ways and leave the decision to the users.

see this commit bc41ae5

It's using another shortcode row to show raw markdown in v0.2.16, so this PR will be merge in to master.

@Lruihao Lruihao merged commit c6255d7 into hugo-fixit:master Aug 27, 2022
@yureiita yureiita deleted the fix-layouts branch May 26, 2024 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants