Skip to content

hugo shortcode to add space between Chinese/Japanese/Korean (CJK) characters and English characters

Notifications You must be signed in to change notification settings

nohzafk/hugo-pangu-spacing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

hugo pangu spacing shortcode

a Hugo shortcode to automatically add spaces between Chinese/Japanese/Korean (CJK) characters and English alphanumeric characters in your Hugo site content.

This ensures better readability and maintains a consistent typographical appearance. Inspried by Emacs pangu-spacing mode.

Usage

wrap the markdown content (apart from the frontmatter) with the panguSpacing shortcode. For example:

{{% panguSpacing %}}
This is a text with ひらがな123 and中文字符intermixed.
{{% /panguSpacing %}}

This will output the text with appropriate spaces added between CJK and English characters:

This is a text with ひらがな 123 and 中文字符 intermixed.

Installation

To use the Pangu Spacing module in your Hugo site, follow these steps:

Add the Module to Your Site Configuration:

Add the following lines to your Hugo site's configuration file (config.toml or config.yaml):

For config.toml:

[module]
  [[module.imports]]
    path = "github.com/nohzafk/hugo-pangu-spacing"

For config.yaml:

module:
  imports:
    - path: github.com/nohzafk/hugo-pangu-spacing

Update Your Hugo Modules:

Run the following command to fetch the new module:

hugo mod get -u github.com/nohzafk/hugo-pangu-spacing
hugo mod tidy

About

hugo shortcode to add space between Chinese/Japanese/Korean (CJK) characters and English characters

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages