Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

div開始タグ直後のテキストが二重に出力される #170

Open
MurakamiShinyu opened this issue Aug 23, 2023 · 0 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@MurakamiShinyu
Copy link
Member

不具合が起きるMDの例:

TEST.md

# TEST

<div>
Text

</div>

VFMでのHTMLへの変換結果:

    <section class="level1" aria-labelledby="test">
      <h1 id="test">TEST</h1>
      <div>TextText</div>
    </section>

div要素内のテキストが "Text" のはずなのが "TextText" と二重に出力されている。

この不具合が起きる条件は以下:

  • 見出しが前にある
  • divなどブロック要素の開始タグ直後に(空行なしで)テキストがある
  • テキストのあとに空行があり、そのあとにHTMLタグ(この例のdiv終了タグ以外でも)がある

Debug log

Run vfm with DEBUG=vfm to see detailed log.

DEBUG=vfm vfm TEST.md
  vfm 
  vfm ### mdast ### +0ms
  vfm root[1]
  vfm └─0 section[3]
  vfm     │ data: {"hName":"section","hProperties":{"class":["level1"],"aria-labelledby":"test"}}
  vfm     │ depth: 1
  vfm     ├─0 heading[1]
  vfm     │   │ depth: 1
  vfm     │   │ data: {"hProperties":{"id":"test"},"id":"test"}
  vfm     │   └─0 text "TEST"
  vfm     ├─1 html "<div>\nText"
  vfm     └─2 html "</div>" +0ms
  vfm 
  vfm ### hast ### +3ms
  vfm root[1] (1:1-7:1, 0-27)
  vfm │ data: {"quirksMode":false}
  vfm └─0 element<section>[2]
  vfm     │ properties: {"className":["level1"],"ariaLabelledBy":["test"]}
  vfm     ├─0 element<h1>[1]
  vfm     │   │ properties: {"id":"test"}
  vfm     │   └─0 text "TEST"
  vfm     └─1 element<div>[1] (1:1-1:7, 0-6)
  vfm         │ properties: {}
  vfm         └─0 text "\nTextText" (1:6-1:1, 5-0) +1ms
  vfm {} +2ms
<!doctype html>
<html>
  <head>
    <meta charset="utf-8">
    <title>TEST</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
  </head>
  <body>
    <section class="level1" aria-labelledby="test">
      <h1 id="test">TEST</h1>
      <div>TextText</div>
    </section>
  </body>
</html>
@MurakamiShinyu MurakamiShinyu added the bug Something isn't working label Aug 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants