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

Class to disable Line Numbers on specific element #2454

Closed
erichlotto opened this issue Jul 3, 2020 · 4 comments · Fixed by #2456
Closed

Class to disable Line Numbers on specific element #2454

erichlotto opened this issue Jul 3, 2020 · 4 comments · Fixed by #2456

Comments

@erichlotto
Copy link

I've been using the Line Numbers plugin attached to my <body> as suggested in the documentation so I don't need to place this class into every single code block on my website, but recently I've needed to use the Command Line plugin and this is the output I have:

image

An option to disable the line-number plugin on a specific element would be nice.

Thanks

@erichlotto
Copy link
Author

Update: I'm currently using .hide-line-numbers .line-numbers-rows { display: none; } as a workaround, if someone is having this issue. Just place hide-line-numbers in your <pre> element.

@RunDevelopment
Copy link
Member

We actually added a solution for this issue just a week ago with #2434.

You can disable Line numbers for any code element by adding a no-line-numbers class that is closer than the closest line-numbers class.
The line-numbers or no-line-numbers class will enable or disable the plugin for the whole subtree.

I'll quickly make a PR that updates the documentation.

@RunDevelopment
Copy link
Member

Note: This feature is currently only available from the download page. If you're getting Prism from npm or any CDN, you'll have to wait until the next version.

@erichlotto
Copy link
Author

That's awesome! I already had the latest version but was unaware of this feature.
Everything works fine now, thank you very much :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants