-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Description
Description
This part of the documentation is misleading and missing information:
Note that this attribute does not support multiple lines, which is not a limitation of Material for MkDocs, but of the Markdown parser.
In fact, as long as new lines are HTML-encoded (i.e. ), they stay perfectly intact when copied.
Additionally, if the value to data-copy contains braces, they must be HTML-encoded as well (i.e. { and }), or the Markdown parser breaks on that code block (which I actually suspect to be a bug - they're already inside double quotes).
It would be nice if these tips and quirks are noted in the documentation.
Basic reproduction:
``` { .c data-copy="int main() { return 0; }" }
Try copying me for some C code
```
Related links
Proposed change
Remove the offending sentence and add the following text after the original paragraph and example:
Due to restrictions from the Markdown parser, newlines and braces must be
HTML-encoded, e.g. ` ` and `{`. For example:
```` markdown title="Code block"
``` { .c data-copy="int main() { return 0; }" }
Try copying me for some C code
```
````
<div class="result" markdown>
``` { .c data-copy="int main() { return 0; }" }
Try copying me for some C code
```
</div>I couldn't work out a satisfactory replacement by myself, so this is just a suggestion. A better example is certainly welcome.
Before submitting
- I have read and followed the documentation issue guidelines.
- I have attached the links to the affected sections of the documentation