Preserve information about leading whitespace in paragraphs
還沒有人認領這個 Issue。
評估
研究方向
從失敗的 ParserTest.noBlockTypes 情境開始,在停用所有區塊類型的情況下檢查 Parser.builder(),然後追蹤輸入行如何變成 Text 節點。使用範例輸入執行測試,並確認第二個 Text 節點保留其開頭的兩個空格。
由索引模型根據 Issue 內容生成。
描述
When using DocumentParser with no enabled block types, the Text nodes do not include whitespaces at the beginning of a line.
For example, when we use a parser with no enabled block types and the input is:
- text 1
- text 2
the expected result is a document containing two Text nodes:
- Text("- text 1")
- Text(" - text 2")
but the second Text is "- text 2" (without preceding whitespaces)
To better illustrate here is a sample test that fails:
public class ParserTest {
...
@Test
public void noBlockTypes() {
String given = "- text 1\n - text 2";
Parser parser = Parser.builder().enabledBlockTypes(Collections.<Class<? extends Block>>emptySet()).build();
Node document = parser.parse(given);
Node child = document.getFirstChild();
assertThat(child, instanceOf(Paragraph.class));
child = child.getFirstChild();
assertThat(child, instanceOf(Text.class));
assertEquals("- text 1", ((Text) child).getLiteral());
child = child.getNext();
assertThat(child, instanceOf(SoftLineBreak.class));
child = child.getNext();
assertThat(child, instanceOf(Text.class));
assertEquals(" - text 2", ((Text) child).getLiteral());
}
}
- 主要語言
- Java
- 星號
- 2.7k
- 分支
- 336
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
commonmark/commonmark-java 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 70/100
commonmark/commonmark-java#460 ·
-
Second code span not recognised after an unclosed backtick string and another code span可能已有人在做 @TanbirRamim 於 13 天前認領。 未關閉
難度 3/5 1-2 天 新手友好度 68/100
commonmark/commonmark-java#458 ·
-
難度 4/5 3-5 天 新手友好度 74/100
commonmark/commonmark-java#457 ·
-
難度 3/5 1-2 天 新手友好度 48/100
commonmark/commonmark-java#443 · 4 則留言 ·
-
Option to define custom flanking/canOpen/canClose rules for delimiters可能重新可做 @abhiramaab 於 57 天前認領,目前沒有進行中的 PR。 未關閉enhancement
難度 4/5 3-5 天 新手友好度 45/100
commonmark/commonmark-java#428 · 4 則留言 ·
查看 commonmark/commonmark-java 的全部 Issue
相似的 Issue
-
enhancement
難度 2/5 1-3 小時 新手友好度 85/100
維護者通常 1 天內回覆
-
waiting-for-triage
難度 1/5 1 小時以內 新手友好度 72/100
spring-cloud/spring-cloud-openfeign#1443 ·
維護者通常 1 天內回覆
-
難度 1/5 1-3 小時 新手友好度 84/100
ADORSYS-GIS/keycloak-oid4vp-plugin#221 ·
維護者通常 2 天內回覆
-
status: team-only type: dependency-upgrade
難度 2/5 1-3 小時 新手友好度 65/100
spring-projects/spring-boot#52099 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 67/100
tchiotludo/akhq#3307 · 1 個 reaction ·
維護者通常 1 天內回覆