-
Notifications
You must be signed in to change notification settings - Fork 82
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
Snippets which include @main #879
Comments
You should be able to use https://scalameta.org/mdoc/docs/modifiers.html#reset-object so that the code is inside an object. I don't think we should filter anything as it might become a complex heuristic easily |
Awesome! This works - thanks :) |
Well, almost ;) If I have multiple
It works with a single snippet. |
Does it work with |
no, |
I think so, though I wonder if that doesn't play nice with |
ah, might be ... the compiler might be generating the top-level method then |
ah yes, a |
For now my recommendation would be to just name it differently. If anyone want to take a look I did a quick stab at it (https://github.com/tgodzik/mdoc/tree/reset-package) , but then forgot I need more than just a package, so we would need to make sure packages are sensibly handled if defined and even if not defined. |
Currently, such snippets cause the following error:
maybe it would make sense to include an option to filter out
@main
from the snippets text, so that example code could still be verified, but also copy-pasteable for anybody wanting to try on their own?The text was updated successfully, but these errors were encountered: