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
-
backend
难度 2/5 1-3 小时 新手友好度 76/100
bcgov/nr-forest-client#2524 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 67/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 74/100
维护者通常 1 天内回复
-
team:Lumberjack
难度 2/5 1-3 小时 新手友好度 76/100
OpenLiberty/open-liberty#35998 ·
维护者通常 1 天内回复
-
[BUG] SQS SendMessageBatch accepts more than 10 entries instead of TooManyEntriesInBatchRequest可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 67/100
维护者通常 1 天内回复