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

Custom Example.svelte needs an extra line at the top #9

Closed
shinokada opened this issue Mar 25, 2022 · 3 comments
Closed

Custom Example.svelte needs an extra line at the top #9

shinokada opened this issue Mar 25, 2022 · 3 comments

Comments

@shinokada
Copy link

shinokada commented Mar 25, 2022

I created src/lib/Example.svelte as you suggested in the README.

<script>
	// the source of the example is provided as a prop if you want it
	export let src;
</script>

<div
	class="container flex flex-wrap justify-center rounded-xl py-8 mx-auto bg-gradient-to-r bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 p-2 sm:p-6"
>
	<slot name="example" />
</div>

<div class="code">
	<pre class="language-svelte">
		<slot name="code" />
	</pre>
</div>

However if I don't add an extra empty line, it messes up the code as you see in the following image.

image

image

If I add an extra line there is too much space.

image

image

@shinokada shinokada changed the title Custom Example.svelte need an extra line at the top Custom Example.svelte needs an extra line at the top Mar 25, 2022
@Tropix126
Copy link
Contributor

To fix this, ensure that your Example.svelte has no whitespace between your <pre> tags and slots

<pre><slot name="code" /></pre>

Unsure if this is intentional or not.

@mattjennings
Copy link
Owner

Yeah my bad, the Example in the README mistakenly had whitespace around the pre tag. I've updated it now. Sorry about that!

@shinokada
Copy link
Author

Thanks. It fixed.
It might be a good idea to mention about it.

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

3 participants