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

removes the syntax highlighting dependency on Net #418

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

finanalyst
Copy link
Collaborator

@coke @dontlaugh This new plugin uses @patrickbkr 's very new entirely Raku syntax highlighter (Rainbow).

  1. The plugin removes the dependency on the atom-highlighter, which was written originally in coffeescript.
  2. In turn, the removal of atom-highlighter removes entirely the dependency on npm and a large number of other javascript dependency in a webpack. This is a major simplification for anyone wanting to install doc-website, but who does not have npm (or equivalent).
  3. Rainbow offers more categories for coloration than the atom-highlighter:
  • instead of variable, we now have scalar, array & hash
  • three regex categories, where none existed before
  • two pod (rakudoc) categories
  • several delimiters
    For the time being I have not differentiated between the variables and delimiters, and kept the colours used by atom-highlighter.
  1. To change the colours, there is a list of variables in rainbow-dark.scss and rainbow-dark.scss ($code-xxx-color). Change the color definition. These are then interpolated into the appropriate classes.

Note that if the new highlighter does not work, then the previous highlighter can be re-enabled by swapping 'highliter' for 'rainbow' in the plugin config file.

@finanalyst finanalyst requested a review from coke October 27, 2024 22:30
@finanalyst
Copy link
Collaborator Author

The effect of the new highlighter will be seen in https://docs-dev.raku.org eg operators

@dontlaugh
Copy link
Collaborator

@finanalyst Do any of the commands run in CI need updating/removing? https://github.com/Raku/doc-website/blob/main/.buildkite/pipeline.yaml#L6

@finanalyst
Copy link
Collaborator Author

@dontlaugh I dont understand why build kite is failing.

  • The change is to replace one plugin with another.
  • The new plugin does not need any of the Net infrastructure used by atom-highlighter
  • So, I thought that I would disable one the one that uses atom-highlighter, but leave the infrastructure in place.
  • I cant see why removing the infrastructure would stop this automatic stop.

I'll add the changes now to remove the Net infrastructure, and see what happens

@finanalyst
Copy link
Collaborator Author

@dontlaugh Should this branch be called 'docs-dev'? I called it 'dev'. Will the rendered files be containered into docs-dev.raku.org?

@finanalyst
Copy link
Collaborator Author

finanalyst commented Oct 29, 2024

@dontlaugh I tried to cancel an intermediate build but could not work out how to do this. Build-kite documentation indicates there is a setting that automatically cancels intermediate builds if two pushes are close together.
Is there a reason we cant use this setting?
I dont have the permissions to cancel a job directly

@finanalyst
Copy link
Collaborator Author

@dontlaugh @coke The new plugin seems to be working VERY much slower than atom-perl6-highlighter. So I think !!!?? this will need some investigation

@patrickbkr
Copy link
Member

I've noticed that the highlighter is slow as well. It's probably not an issue with your setup, but with Rainbow itself. I do need to look into this at some point, it just didn't make it to the top of my priority list. @finanalyst Is this a blocker for you? If so, I can bump it to the top.

@dontlaugh
Copy link
Collaborator

The build is timing out, that's why it's failing. No container will be built until it's green.

Also note that "dev" nor "docs-dev" are automatically deploying right now. That's my bad: I needed to fail prod over to dev a couple of weeks ago.

Let's work on getting this tested locally, then getting the build green. I'll upgrade the build environment tonight. Note that this build is not running the latest Rakudo.

@finanalyst
Copy link
Collaborator Author

@patrickbkr Thanks for responding here. I was just going to raise an issue on the Rainbow repo.
Doc-website uses Sam McVey's atom-perl6-highlighter at present, but it is the only non-Raku element of the tool-chain to the rendered files. The problem is that we need a whole .Net infrastructure to get it to run.
So, its not a blocker per se, but it would be much more elegant to be able to use Rainbow.
But we can't use Rainbow until its much faster.

@@ -1,7 +1,7 @@
{
"name": "Raku-Official-Documentation",
"description": "Tool chain for creating the Raku official documentation site",
"version": "0.1.1",
"version": "0.1.2",
Copy link
Collaborator

Choose a reason for hiding this comment

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

@finanalyst Will this version optionally work with the current highlighting toolchain?

If it is, we can create a separate build pipeline for the new Rainbow highlighter. This way, we can continue to assist @patrickbkr in testing, while keeping the current site up to date.

In other words, would POD_RENDER_NO_HIGHLIGHTER=0 use the current nodejs toolchain, even if the rest of this code was checked in?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@dontlaugh I'm reverting the change that stops installation of Highlighter at present.
The problem is caused by Rainbow being too slow, not by the installation of atom-perl6-highlighter or the nodejs toolchain.

To answer your question directly, the nodejs toolchain (more precisely, npm) is installed in the docker environment AFAIK before zef is called because zef does not install non-Raku dependencies.
The BUILD callable for Raku-Pod-Render, which is invoked by zef, checks to ensure that npm is installed, and would fail otherwise.
POD_RENDER_NO_HIGHLIGHTER stops zef from cloning 'atom-perl6-highlighterand usingnpm` to install it into the Raku environment.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@dontlaugh more abstractly: Rainbow could be merged into MAIN so long as configs/02-plugins.raku is not changed.
The atom-perl6-highlighter is used by the hiliter plugin, while Rainbow is used by the rainbow plugin. They are 1-1 interchangeable as far as Collection is concerned.

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.

3 participants