-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Ignore linebreaks between Chinese/Japanese characters in source code #792
Copy link
Copy link
Open
Labels
cjkChinese, Japanese, Korean typography.Chinese, Japanese, Korean typography.feature requestNew feature or requestNew feature or requestsyntaxAbout syntax, parsing, etc.About syntax, parsing, etc.textRelated to the text category, which is all about text handling, shaping, etc.Related to the text category, which is all about text handling, shaping, etc.
Description
Typst currently support breaking a paragraph into several consecutive lines in source code, without introduce a newline in result PDF. The single newline in source code will just become a space. However, when working with scripts that do not using spaces between words, like Chinese and Japanese, we often not want to have the newline, nor the space.
In a paragraph like this:
中文
测试
In Chinese context, the most sensible result is 中文测试, without any spaces and newlines.
I propose implementing the following features in typst:
- Eliminate spaces between CJK characters in source code.
- Let trailing comment consume a linebreak in source code.
This is because sometimes we have a inline frame and CJK detect will not work, so we need an opt-in method. I think the changed behavior can be minimal, comments will consume new line only if it has no space before it.
For example, this codebecomesabc // defabc def
andbecomesabc// defabcdef.
Latin users often use the former one so they will not be affected.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
cjkChinese, Japanese, Korean typography.Chinese, Japanese, Korean typography.feature requestNew feature or requestNew feature or requestsyntaxAbout syntax, parsing, etc.About syntax, parsing, etc.textRelated to the text category, which is all about text handling, shaping, etc.Related to the text category, which is all about text handling, shaping, etc.