-
Notifications
You must be signed in to change notification settings - Fork 661
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
Register new style #2183
Register new style #2183
Conversation
Could you please add a test which exercises the new behavior? |
Um, for a doc PR about patching the sources? Though, isn't it better to document how to register a style via a plugin rather than by patching your Pygments distribution? |
Ok so wait, |
Regarding this PR: I think the advice to copy stuff into the Pygments package should be removed wholesale, or at least clarified to only apply if you add a new style for submission as a PR. |
+1 |
@birkenfeld bd9eff0 only tries to represent the existing information more simply. The main need for it is the manual change to https://pygments.org/docs/ Hacking for Pygments is written around changing the Pygments package. I don't disagree it should be written around developing a Plugin but the section would need rewriting. It should start with https://pygments.org/docs/plugins/ containing a fully working |
This is from def get_style_by_name(name):
if name in STYLE_MAP:
mod, cls = STYLE_MAP[name].split('::')
builtin = "yes"
else:
for found_name, style in find_plugin_styles():
if name == found_name:
return style
# perhaps it got dropped into our styles package
builtin = ""
mod = name
cls = name.title() + "Style" Ugh. I wonder if this should be left undocumented or just removed. |
It's not documented in the existing guide but implied. The guide has example style code followed by "That's it.". It truly is it if the file is placed into the style folder and the user doesn't need the services from registering the style (ie bringing up on a list of styles). It's useful functionality so I wouldn't remove it but it is probably not worth any more documentation than a comment in the code. |
Hm, I don't like that either. It's also different from other components (lexers, formatters). |
What's the next step here? It feels like we can merge this change and then continue with the rest elsewhere? |
Merged, thanks. I'll add a warning note to the documentation to address @birkenfeld 's feedback. We still need a resolution for |
Explain that adding styles to the source tree directly is something that should be only used by contributors.
Closes #980