CosmWasm / docs

https://cosmwasm-docs.vercel.app
Apache License 2.0
6 stars 3 forks source link

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

Open chipshort opened 4 months ago

chipshort commented 4 months ago

SEE https://github.com/CosmWasm/docs/issues/37#issuecomment-2160886724 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 commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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