Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Description on how soft line breaks are treated in browsers doesn't consider the combination of Firefox & Chinese/Japanese text and should be improved

Abierto
#744 4 comentarios 2 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
38/100
Tipo de issue
Documentación
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
css, html

Línea de trabajo

Start with the soft-break section at spec.commonmark.org/0.30/#softbreak and compare its wording with CSS Text Module 4's line-break transformation rules. Reproduce the linked CodePen and Dingus examples in Firefox and Chromium-based browsers, including the Chinese, Japanese, and Korean cases. Done means the specification text accurately describes browser-dependent rendering and the relevant language behavior.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

https://spec.commonmark.org/0.30/#softbreak

The description on a soft line break looked ambiguous or questionable for me.

A soft line break may be rendered in HTML either as a line ending or as a space.

Does it mean Markdown-to-HTML converters are allowed to convert a soft line break in Markdown to either of "\n" (or possibly "\r" or "\r\n") or " " in HTML? Generally "may" in specifications means "is allowed to and does not have to" (RFC 2119) and confused me.
I have no idea when "a soft line break is rendered in HTML as a line ending". Is it when whitespace: preserve or some other values is passed in CSS? Also is there a case when a soft line break is rendered in HTML as other than a line ending or a space?

The result will be the same in browsers.

This is wrong. How "\n" in HTML is rendered differs among browsers when Chinese or Japanese are contained.

https://drafts.csswg.org/css-text-4/#line-break-transform

Then any remaining segment break is either transformed into a space (U+0020) or removed depending on the context before and after the break. The rules for this operation are UA-defined in this level.

This means how a soft line break is rendered depends on browsers' implementations.

In languages that have no word separators, such as Chinese, “unbreaking” a line requires joining the two lines with no intervening space.

這個段落是那麼長,
在一行寫不行。最好
用三行寫。

↓

這個段落是那麼長,在一行寫不行。最好用三行寫。

Only Firefox follows this recommendation as of now. (However, spaces are inserted like the other browsers when copied and pasted on somewhere else!)

https://codepen.io/tats-u/pen/YzdKKyN

<p lang="zh-Hant-tw">這個段落是那麼長,
在一行寫不行。最好
用三行寫。</p>

image
↑Firefox (intended)

image
↑Edge (WebKit / Blink / IE; not intended; space after "," is selected)

https://codepen.io/tats-u/pen/poQQVyR (what kind of CJK letters remove a newline between them? → Korean is treated like alphanumeric characters unlike Japanese)

<p>잘자
(
잘자
)
잘자
잘자
あああ
(
あああ
)
ああああ
1
ああ
ああ
。
1
。</p>

image
↑ FIrefox

image
↑Edge (and other WebKit & Blink based browsers / IE)

https://spec.commonmark.org/dingus/?text=%23%23%20%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%81%A8%E4%B8%AD%E5%9B%BD%E8%AA%9E%E3%81%AE%E4%BE%8B%0A%0A%E3%81%93%E3%82%8C%E3%81%AF%E6%97%A5%E6%9C%AC%0A%E8%AA%9E%E3%81%AE%E6%96%87%E7%AB%A0%E3%81%A7%0A%E3%81%99%E3%80%82%E8%BF%99%E6%98%AF%E4%B8%80%0A%E4%B8%AA%E4%B8%AD%E6%96%87%E5%8F%A5%E5%AD%90%E3%80%82%0A%0A

image
↑Firefox (looks natural)

image
↑Edge (Wekit / Blink / IE; doesn't look natural)

From these results, we can conclude only "\n" between Chinese or Japanese letters (han/kana) or punctuation marks is removed instead of replaced with " " in Firefox.

Also,

The result will be the same in browsers.

This sentence must be replaced with like:

The result will follow the CSS Text Module specification and might depend on browsers (but should be same in languages that use a space to segment words).

Lenguaje dominante
Python
Estrellas
5.2k
Forks
360
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de commonmark/commonmark-spec

Todos los issues de commonmark/commonmark-spec

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.