-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Request for tips on contributing a new language definition #1249
Comments
Hi!
This looks pretty good to me. Note that you can remove all the
You've listed the essential steps already. However, it's better if you can provide a PR that includes two more things:
Now that's a tough one. My answer should be "Yes, your classes must be semantically appropriate and you do need to update all themes accordingly indeed". Unfortunately, this is hardly maintainable (even more considering the non-official themes). We do have an open issue to address this problem (#1055) but haven't come with an appropriate solution yet.
|
Thanks very much for the informative reply. I've edited the regexes as you suggest, except, so far, for the arrays: I'm going to cogitate over that. I'm torn between the readability (as far as regexes can be considered to be readable) of the arrays (matching distinctly different forms of syntax) versus performance. Regarding coining new tokens: I've shown the styled results to a few experienced JCL users, and, while they like the idea of the highlighted syntax, they're not thrilled with the colors used for the "less-semantic" classes in the default Prism theme; in particular, red or reddish colors. Many JCL users will only ever have seen JCL syntax highlighted in the native z/OS ISPF text editor, as displayed in a terminal emulator such as IBM Personal Communications ("PCOMM"); to such users, other color schemes might look odd. For now, partly because I don't have much time to spend on this, for my local repo, I will continue to use bespoke, semantically appropriate class names for styling. Another reason: I want more variety. For example, JCL supplied with a product often includes "placeholder" values (to be replaced with actual values) that, by convention, are JS:
CSS:
Finally, for now: I will admit this is entirely my problem, but I thought I'd share this "noob" experience with you... I am not, primarily, a JavaScript developer. I have dipped into JavaScript every few years since the early web browsers (with increasing frequency, especially since Why am I bothering telling you this? Perhaps in case other noobs report similar issues; perhaps, they, too, might be trying to put their own language definitions in a custom script, heeding—without fully understanding—the instructions about not editing |
You're right, the async highlighting uses the main We usually consider most people will use the Download page to craft their own bundle of Prism, including all the languages they want to highlight. Doing this, they'll end up with a single file, indeed. We might want to update the documentation somewhere to help new users address the issue you faced. |
I've started developing a Prism language definition for IBM z/OS MVS JCL.
I'm already pretty happy with the results. Thank you!
Here's the work-in-progress definition:
CSS:
I'd gratefully accept tips or advice on the above. I've been referring to the MDN documentation on JavaScript regular expressions.
I'm looking ahead to the possibility of submitting a pull request to add this language definition to the public Prism repo. I've done some research on how to do this:
I get that I would need to:
/components/prism-jcl.js
and/components/prism-jcl.min.js
components.js
with a new entry for this languageHowever, I'm unclear what else I need to do.
In particular, while I know I need to add the CSS rules for the new
operation
andname
tokens I've coined for this language—to match the operation and name fields described in the JCL documentation (see the earlier link)—does that mean I need to add CSS rules to each of the theme-specific CSS files?That question makes me wonder whether I should rethink coining those, or any, new tokens.
Should I coin new tokens?
Perhaps I shouldn't get hung up on using token names that match the terminology of the language; perhaps I should instead use existing token names defined by Prism, even if those names don't match JCL terminology.
Advice, thoughts, recommendations gratefully accepted. (Including: "This is the wrong place to ask such questions. Try asking a specific question on Stack Overflow and tagging it
prism.js
.")The text was updated successfully, but these errors were encountered: