
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
kanji-typesetting
Advanced tools
A JavaScript library for Japanese/Chinese typography and typesetting
Kanji Typesetting (npm: kanji-typesetting)
is a modernized reimplementation of Han-CSS, a typesetting framework for Chinese and other Han-script web pages.
It integrates semantic style normalization, text design, and advanced typesetting features into a unified CSS + JavaScript framework.
Kanji Typesetting provides a beautiful, standardized environment for Han character typography — faithful to traditional reading habits yet optimized for digital screens — effectively solving the long-standing layout challenges in Han-script web design.
The original Han-CSS project, however, has not been actively maintained for years. Its build system depends on an outdated version of Gulp, the code does not follow modern JavaScript conventions, and it lacks features such as server-side rendering (SSR) support.
Han-CSS-Q was created as an effort to modernize Han-CSS.
I (syhily) have now forked Han-CSS-Q again, continuing its modernization under the new name Kanji Typesetting, distributed via npm as kanji-typesetting.
This fork inherits all improvements from Han-CSS-Q while further enhancing usability, modularity, and compatibility with modern front-end ecosystems.
Compared with the original Han-CSS, Kanji Typesetting introduces several major updates:
Kanji Typesetting is still under active development. Most features are functional, but due to the scope of the refactor and incomplete testing, results may differ slightly from the original Han-CSS. You can see it in production on sharzy.in, which fully adopts Han-CSS-Q.
Install Kanji Typesetting from npm:
yarn add kanji-typesetting
# or
npm install kanji-typesetting
Alternatively, install directly from GitHub:
yarn add git+https://github.com/syhily/kanji
# or
npm install git+https://github.com/syhily/kanji
Kanji Typesetting consists of two parts:
Since Kanji Typesetting ships with precompiled CSS, you can import it directly from the package:
import 'kanji-typesetting/style'
or in a CSS file:
@import 'kanji-typesetting/style';
This works with most modern bundlers and frameworks, including Vite, Next.js, Nuxt, and Webpack.
💡 Tip: The CSS bundle automatically includes the default font and layout settings. If you need to override font paths or variables, you can do so via standard CSS overrides after import.
Example:
@import 'kanji-typesetting/style';
:root {
--han-line-height: 1.6;
--han-article-line-height: 1.6;
}
Import the JavaScript API in your entry script or component:
import Han from 'kanji-typesetting'
import 'kanji-typesetting/style'
Create a Han instance and render:
const han = new Han(
document.querySelector('article'),
document.documentElement,
)
han.render()
The default rendering pipeline runs the following steps:
const defaultRoutine = [
'initCond',
'renderElem',
'renderJiya',
'renderHanging',
'correctBiaodian',
'renderHWS',
]
You can customize it:
han.setRoutine(['initCond', 'renderElem', 'renderJiya', 'renderHWS']).render()
Kanji Typesetting provides the following processing steps:
Initialization — initCond()
Semantic element normalization — renderElem(), including:
renderRuby() — ruby annotationsrenderDecoLine() — text decorationrenderEm() — emphasized textHanging punctuation — renderHanging()
Punctuation compression (jiya) — renderJiya()
Han–Western spacing — renderHWS()
Basic punctuation correction — correctBasicBD() (for browsers without native support)
Ligature substitution — substCombLigaWithPUA()
Character accuracy correction — substInaccurateChar()
For detailed explanations, see the Han-CSS documentation.
Kanji Typesetting provides typographic corrections for standard HTML elements, ensuring they conform to professional Han typesetting conventions. See the original documentation for details.
It also defines refined font stacks for consistent rendering across platforms. See text design documentation for more details.
✅ Summary
Kanji Typesetting (npm: kanji-typesetting)
is a modern, production-ready reimplementation of Han-CSS, continuing from Han-CSS-Q with:
Kanji Typesetting aims to deliver a clean, modular, and production-ready framework for high-quality Han character web typography.
FAQs
A JavaScript library for Japanese/Chinese typography and typesetting
We found that kanji-typesetting demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.