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

Add support for custom css styling for the preview #33

Open
1pronik opened this issue Feb 16, 2025 · 5 comments · May be fixed by #46
Open

Add support for custom css styling for the preview #33

1pronik opened this issue Feb 16, 2025 · 5 comments · May be fixed by #46
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@1pronik
Copy link

1pronik commented Feb 16, 2025

I using Tailwindcss 4 with dark mode.
When I click the "Preview" button I see almost everything dark.

It will be great to add support for custom classes on preview rendering,
or update the Readme.md with example if it's already possible.

Screenshots:
Image
Image

@adrianthedev
Copy link
Contributor

Would you be open to send in a PR for this tweak?

@adrianthedev adrianthedev added enhancement New feature or request help wanted Extra attention is needed labels Feb 17, 2025
@1pronik
Copy link
Author

1pronik commented Feb 17, 2025

Would you be open to send in a PR for this tweak?

I'm not sure I can do that, at least not shortly.

@cannikin
Copy link

Maybe there could be a configuration variable like preview_css_class and you can include class(es) that will wrap the preview container. If this value isn't set then default to what's there now: ms:prose ms:prose-neutral

Then you just need to define your own styles as children of the selector given in the config var.

In my app, when I display markdown I have a .markdown class on the container. In my CSS I define how all elements should be styled within that container:

.markdown {
  h1 {
    @apply text-3xl font-semibold;
  }
}

This way both the regular display and the preview would be identical, inheriting the same styles.

@adrianthedev
Copy link
Contributor

Heads up, in version 0.3 we'll rename the marksmith class to marksmith-editor.

But yeah. That's a great solution!

@1pronik how do you implement dark mode? Using prefers-color-scheme or by having a .dark class on your body?

@1pronik
Copy link
Author

1pronik commented Feb 21, 2025

@1pronik how do you implement dark mode? Using prefers-color-scheme or by having a .dark class on your body?

hey @adrianthedev, I'm using the .dark class on the html tag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants