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

Wrong rendering of HTML blocks #433

Open
kukimik opened this issue Apr 25, 2023 · 4 comments
Open

Wrong rendering of HTML blocks #433

kukimik opened this issue Apr 25, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@kukimik
Copy link
Contributor

kukimik commented Apr 25, 2023

Describe the bug
HTML blocks in markdown documents are not rendered properly. Check the example below.

To Reproduce
I use the current HEAD version of Emanote (i.e. 7063381).

Create a .md file with the following content:

aaaa

<details>

**bbb** ccc *ddd*

</details>

eee

Emanote generates the following HTML:

    <p class="mb-3">
      aaaa
    </p>
  <div xmlhtmlraw=""><details>
</details></div>
    <p class="mb-3">
      <strong>bbb</strong> ccc <em>ddd</em>
    </p>
  <div xmlhtmlraw="">
</div>
    <p class="mb-3">
      eee
    </p>

Expected behavior

See the CommonMark Spec on HTML blocks.
The reference Commonmark implementation https://spec.commonmark.org/dingus/ converts this to:

<p>aaaa</p>
<details>
<p><strong>bbb</strong> ccc <em>ddd</em></p>
</details>
<p>eee</p>

I would expect similar output.

Additional context
I'm especially interested in the <details> tag to create an effect similar to this:

bbb ccc ddd

However, the problem probably also applies to other HTML tags.

#23 may be related.

@kukimik kukimik added the bug Something isn't working label Apr 25, 2023
@srid
Copy link
Owner

srid commented Apr 29, 2023

Isn't this an issue with upstream library which emanote uses? https://github.com/jgm/commonmark-hs

@kukimik
Copy link
Contributor Author

kukimik commented May 4, 2023

Probably not. The commonmark-cli tool with all extensions turned on (commonmark -x all) parses this correctly. This could be something about the order of the extensions, but I don't think so. Unfortunately at the moment I don't have time to diagnose this properly.

@kukimik
Copy link
Contributor Author

kukimik commented May 9, 2023

Emanote.Model.Note.parseNoteMarkdown returns (checked via traceShowId):

[
Para [Str "aaaa"]
,RawBlock (Format "html") "<details>\n"
,Para [Strong [Str "bbb"],Space,Str "ccc",Space,Emph [Str "ddd"]]
,RawBlock (Format "html") "</details>\n"
,Para [Str "eee"]
]

This looks correct.

@seangenabe
Copy link

<span><span> just outright errors out for me which is fun /s to see.

[Info#ema.ws.364] Connected
span cannot contain text looking like its end tag
CallStack (from HasCallStack):
  error, called at src/Text/XmlHtml/HTML/Render.hs:133:9 in xmlhtml-0.2.5.4-DHjeAs4exZFKFYPJOci4Cd:Text.XmlHtml.HTML.Render

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

3 participants