Page MenuHomePhorge

Improve remarkup codeblock syntax highlighting when using Dark Mode
ClosedPublic

Authored by mturdus on Jan 9 2024, 21:56.

Details

Summary

PhabricatorDefaultSyntaxStyle works now with 'CSS-color-aliases' instead of fixed colors.

The aliases are translated in the corresponding themes CelerityPostprocessor.

BeforeAfter
Before D25509.png (382×396 px, 26 KB)
After D25509.png (382×396 px, 35 KB)

Ref T15056

Test Plan
  1. bin/celerity syntax
  2. bin/celerity map
  3. bin/cache purge --all
  4. sign in
  5. go to user's Settings > Display Preferences and select the Accessibility (user interface) "Dark Mode".
  6. go to Phriction or Maniphest and add a codeblock.

Example:

<?php
final class Example extends PhabricatorApplication {
}
  1. verify that codeblock content is readable
  2. also check that with/without this, nothing changes in "normal" theme

Diff Detail

Repository
rP Phorge
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

mturdus requested review of this revision.Jan 9 2024, 21:56

Can someone explain what these "Code coverage needs to be enabled in php.ini by setting 'xdebug.mode' to 'coverage'" messages mean ?
Are these automated unit tests run on we.phorge.it or on my system ?

Run arc diff from my computer that has Xdebug enabled

valerio.bozzolan retitled this revision from Fix remarkup codeblock syntax highlighting when using Dark Mode to Improve remarkup codeblock syntax highlighting when using Dark Mode.
valerio.bozzolan edited the summary of this revision. (Show Details)
valerio.bozzolan edited the test plan for this revision. (Show Details)

I sincerely think this is lovely. Thanks. I do not understand how you figure it out all these keywords and in what order and associated to what, but hey, it works.

sgtm

This revision is now accepted and ready to land.Jan 12 2024, 09:55

I copy/pasted the keys of the getStyleMap() function dictionary into chatgpt with some remark that they were part of a syntax highlighting mechanism.
I asked it to translate them into something more readable.

I thought this was already in the repo, but I forgot to execute arc land... (sorry)
I bump into a 403 error when I execute it now.
I had one merge conflict in resources/celerity/map.php which I corrected manually.

These are the commands I executed and their output:

gj@blackbird:/var/www/htdocs/phorge/phorge$ ###################################################################################################
gj@blackbird:/var/www/htdocs/phorge/phorge$ git status
interactive rebase in progress; onto bf15a2d98c
Last command done (1 command done):
   pick 8253e10648 Fix remarkup codeblock syntax highlighting when using Dark Mode
No commands remaining.
You are currently rebasing branch 'master' on 'bf15a2d98c'.
  (all conflicts fixed: run "git rebase --continue")

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        modified:   resources/celerity/map.php
        modified:   src/applications/celerity/postprocessor/CelerityDarkModePostprocessor.php
        modified:   src/applications/celerity/postprocessor/CelerityDefaultPostprocessor.php
        modified:   src/infrastructure/syntax/PhabricatorDefaultSyntaxStyle.php
        modified:   webroot/rsrc/css/syntax/syntax-default.css

gj@blackbird:/var/www/htdocs/phorge/phorge$ ###################################################################################################
gj@blackbird:/var/www/htdocs/phorge/phorge$ git rebase --continue
[detached HEAD 5719d1e24b] Fix remarkup codeblock syntax highlighting when using Dark Mode
 5 files changed, 350 insertions(+), 130 deletions(-)
Successfully rebased and updated refs/heads/master.
gj@blackbird:/var/www/htdocs/phorge/phorge$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)

nothing to commit, working tree clean
gj@blackbird:/var/www/htdocs/phorge/phorge$ ###################################################################################################
gj@blackbird:/var/www/htdocs/phorge/phorge$ ../arcanist/bin/arc land
 STRATEGY  Merging with "squash" strategy, the default strategy.
 SOURCE  Landing the current branch, "master".
 ONTO REMOTE  Remote "origin" was selected by following tracking branches upstream to the closest remote.
 ONTO TARGET  Landing onto target "master", selected by following tracking branches upstream to the closest remote branch.
 INTO REMOTE  Will merge into remote "origin" by default, because this is the remote the change is landing onto.
 INTO TARGET  Will merge into target "master" by default, because this is the "onto" target.
 FETCH  Fetching "master" from remote "origin"...

  $   git fetch --no-tags --quiet -- origin master


 INTO COMMIT  Preparing merge into "master" from remote "origin", at commit "bf15a2d98ca3".
 LANDING  These changes will land:

  *   D25509 Improve remarkup codeblock syntax highlighting when using Dark Mode
          5719d1e24bc1  Fix remarkup codeblock syntax highlighting when using Dark Mode

 >>>  Land these changes? [y/N/?] y
 MERGING  5719d1e24bc1 Fix remarkup codeblock syntax highlighting when using Dark Mode
 MERGE  Attempting to rebase changes.
 DONE  Merge succeeded.
 PUSHING  Pushing changes to "origin".

  $   git push -- origin 775e7fd2324d:refs/heads/master

fatal: unable to access 'https://we.phorge.it/source/phorge.git/': The requested URL returned error: 403

 LOAD STATE  Restoring local state (to ref "master" at commit "5719d1e24bc1").
 USAGE EXCEPTION  Push failed! Fix the error and run "arc land" again.
gj@blackbird:/var/www/htdocs/phorge/phorge$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)

nothing to commit, working tree clean

What should I do here ?

I suggest to visit here:

https://we.phorge.it/source/phorge/

Click on clone, and click on the Manage icon to set your HTTPs credentials.

(I originally cloned via SSH and I've uploaded my SSH hey, using the same menu nearby ssh://git)

Mission accomplished.
Thanks