nohzafk / hugo-pangu-spacing

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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


Languages

Language:HTML 100.0%