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

Fix in syntax.md. CSS adjustments #14747

Merged
merged 4 commits into from
Mar 28, 2022

Conversation

pikinier20
Copy link
Contributor

Copy link
Member

@KacperFKorban KacperFKorban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that we have to update the highlight.pack.js since it doesn't include support for ebnf ATM. Though for some reason it includes OCaml and Ruby for example 🤔

Overall, I think that the change to styling is a big improvement 😄

@pikinier20
Copy link
Contributor Author

I think that we have to update the highlight.pack.js since it doesn't include support for ebnf ATM. Though for some reason it includes OCaml and Ruby for example 🤔

Overall, I think that the change to styling is a big improvement 😄

highlight.js doesnt provide support to ebnf, there's only bnf supported

@KacperFKorban
Copy link
Member

Hmmm, there is some code that looks likebnf support in hljs repo.
rel: highlightjs/highlight.js#1255

@pikinier20
Copy link
Contributor Author

Tried to bump hljs version and use ebnf syntax highlighting for this snippet but it broke:
image

@pikinier20
Copy link
Contributor Author

Ok, just manually changed the hljs rules and added semicolons at the end of rules and got sth better:
image

Probably there's a way to remove the semicolons but it would require some work on hljs rules

@pikinier20
Copy link
Contributor Author

image
this looks nice

@pikinier20 pikinier20 marked this pull request as draft March 28, 2022 08:16
@pikinier20 pikinier20 force-pushed the scaladoc/css-adjustments branch from ef59d97 to 0443992 Compare March 28, 2022 08:44
@pikinier20 pikinier20 force-pushed the scaladoc/css-adjustments branch from f9ce476 to a60c4e7 Compare March 28, 2022 11:19
@pikinier20 pikinier20 marked this pull request as ready for review March 28, 2022 11:49
@pikinier20 pikinier20 merged commit 1baaa90 into scala:main Mar 28, 2022
@pikinier20 pikinier20 deleted the scaladoc/css-adjustments branch March 28, 2022 12:37
@odersky
Copy link
Contributor

odersky commented Apr 18, 2022

I am afraid the change of semicolons completely butchered the grammar. The grammar is the core piece of specification. Every symbol counts. Please don't do wholesale changes like this without consulting more broadly.

@odersky
Copy link
Contributor

odersky commented Apr 18, 2022

I find it very problematic that a PR pretending to be style fix can change a core piece of the specification and all docs without passing proper review. We have to review how we deal with PRs and how we can avoid such blunders in the future.

@odersky
Copy link
Contributor

odersky commented Apr 18, 2022

I'll revert the commit for now, and re-open the issue.

@odersky
Copy link
Contributor

odersky commented Apr 18, 2022

I see now that all the ; are meta-symbols for the EBNF, not symbols of the grammar itself. But we never did it that way. Every Java and Scala grammar I know is written without ; terminators, for good reason: The ; is too easily confused with a symbol in the grammar. So, please don't do sweeping changes to the docs like this.

@odersky
Copy link
Contributor

odersky commented Apr 18, 2022

I think in general if it is a change that affects docs wholesale it has to be discussed in team with the authors of the docs. I find it very frustrating to see docs I spent many hours writing massacred like this.

@pikinier20
Copy link
Contributor Author

I see now that all the ; are meta-symbols for the EBNF, not symbols of the grammar itself. But we never did it that way. Every Java and Scala grammar I know is written without ; terminators, for good reason: The ; is too easily confused with a symbol in the grammar. So, please don't do sweeping changes to the docs like this.

The highlight.js tool which we use to highlight the syntax, is not very sophisticated and uses basic regexes to consume grammars. The authors of EBNF highlighting added these semicolons in order to simplify rules and not use lookaheads etc. (You need to know when the rule ends to parse next token as a LHS of next rule)

I'm sorry about this situation. I guess we can just replace the semicolons with some invisible unicode character or any other symbol that won't be misleading.

@Kordyjan Kordyjan added this to the 3.1.3 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

docs: broken highlighting in syntax summary for "
4 participants