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

[docs-test-gen] Indented code blocks ignored #37

Open
chipshort opened this issue Jun 7, 2024 · 3 comments
Open

[docs-test-gen] Indented code blocks ignored #37

chipshort opened this issue Jun 7, 2024 · 3 comments

Comments

@chipshort
Copy link
Contributor

chipshort commented Jun 7, 2024

SEE #37 (comment) FOR DISCLAIMER

Original issue follows now


Code blocks that are indented with whitespace are silently ignored by the docs-test-gen.
This is mostly a problem when putting code blocks inside <Tabs></Tabs>.

@aumetra aumetra self-assigned this Jun 11, 2024
@aumetra
Copy link
Member

aumetra commented Jun 11, 2024

Can't reproduce this by just indenting them. But I can reproduce this when putting them in a block like this (ignore the backslashes, otherwise GH formatting would terminate them):

<Block>
  \```
  \```
</Block>

But that's standard with Markdown parsers. If you want to use Markdown syntax inside of HTML tags, you need to add one newline between the tag and the Markdown syntax.

This is how it works (tested it locally):

<Block>

  \```
  \```

</Block>

@chipshort
Copy link
Contributor Author

You're right that this only happens inside blocks, but for me it still happens with newlines in-between.
This still gets ignored for me:

<Tabs items={['example']}>
    <Tabs.Tab>

      \```rust template="execute"
      this should fail!
      \```

    </Tabs.Tab>
</Tabs>

@aumetra aumetra pinned this issue Jun 11, 2024
@aumetra
Copy link
Member

aumetra commented Jun 11, 2024

Apparently this is an issue with pulldown-cmark and comrak.

So this is a disclaimer to everyone writing docs: DO NOT INDENT YOUR CODEBLOCK MORE THAN ONE TAB! OTHERWISE THE PARSER WILL NOT PICK IT UP AND IGNORE IT

@aumetra aumetra removed their assignment Jun 25, 2024
@DariuszDepta DariuszDepta unpinned this issue Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants