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

custom syntax highlighting of gaml code in github markdown #49

Open
sriramab opened this issue Dec 6, 2017 · 7 comments
Open

custom syntax highlighting of gaml code in github markdown #49

sriramab opened this issue Dec 6, 2017 · 7 comments

Comments

@sriramab
Copy link
Member

sriramab commented Dec 6, 2017

Hi,

I have been wondering if it is possible to have some custom gaml highlighting for code blocks in github markdown. For example, if you use a code block code block with a language preference for r , it highlights r keywords as below

library(gaml)
k=mean(rnorm(100,1,0.1)

or for python as below:

import numpy as n
float f = n.sin(90)

or java as below:

import numpy
float f = n.sin(90);

Is it possible to create a custom syntax highlight for gaml language on github markdown? I do not know how easy or difficult it is, but could be nice in sharing or exhibiting code on github tutorials.

@AlexisDrogoul AlexisDrogoul transferred this issue from another repository May 14, 2019
@RoiArthurB
Copy link
Collaborator

For the Github Wiki I'm afraid that it's impossible (mainly because we can't do any design more than the MarkDown Structure of the file).
But I'm working on it for the gama-platform website :)

@RoiArthurB RoiArthurB self-assigned this May 15, 2019
@lesquoyb lesquoyb added this to To do in Gama 1.9.1 Mar 17, 2022
@AlexisDrogoul AlexisDrogoul moved this from To do to To fix in Gama 1.9.1 Mar 20, 2022
@lesquoyb lesquoyb moved this from To fix to won't be fixed in Gama 1.9.1 May 8, 2022
@RoiArthurB
Copy link
Collaborator

Since we moved to Docusaurus V2, CodeBlocks are rendered using the Prism engine (source).

It's not easier to implement, but it's a famous tool in JS world and used by Ghost, MDN, etc; so it may be easy to extend it to other usages (like, maybe, a plugin for GitHub Highlight library 😄 ).

I won't work on it any time soon, but if anyone wants to do it, feel free to help 😉 It can either be a PR on the main project, or just a language extension added only on the website

@RoiArthurB RoiArthurB pinned this issue May 25, 2022
@benoitgaudou
Copy link
Contributor

Hi @RoiArthurB ,

Please find below a very small js tentative for GAML (rename it as .js).
prism-gaml.txt

If GAMA produces such a file you can use it on the website?

RoiArthurB added a commit that referenced this issue Oct 14, 2022
@RoiArthurB
Copy link
Collaborator

Hi @benoitgaudou ,

You're quick implementation does work good, see below :

Before After
image image
image image

So if you can generate this file from GAMA, I'll be easily able to integrate it during the website compilation 👌

I also made the branch syntax-gaml to work on it :)

@benoitgaudou
Copy link
Contributor

Thanks!
I am not so impressed by the after version : it was supposed to highlight the statement names also ... but get italic instead, I guess it is mainly due to the css ...
Thanks for the integration and for the branch.... but how to use this new branch ? I can produce the website by myself locally ?

@RoiArthurB
Copy link
Collaborator

@benoitgaudou

I am not so impressed by the after version : it was supposed to highlight the statement names also ... but get italic instead, I guess it is mainly due to the css ...

Yes, we probably can also tweak the color theme or badly used the syntax to just have appropriate colors on the wiki 🤷 But it's minor tweaking in my point of view :)

Thanks for the integration and for the branch.... but how to use this new branch ? I can produce the website by myself locally ?

Yes you can, it's a little tricky so either we can do it together, otherwise it's mostly following step-by-step the github action here : https://github.com/gama-platform/gama-platform.github.io/blob/sources/.github/workflows/github-travis.yml

You'll need to have Python3, pip (package manager for Python), NodeJS, yarn (or npm; both package managers for NodeJS) and bash - I know it's a bit heavy and complex 😅😅

Gama 1.9.1 automation moved this from won't be fixed to Done Oct 17, 2022
@RoiArthurB
Copy link
Collaborator

Re-opening to work on full Github's syntax support color (forgot that initial issue request 🙈)

@RoiArthurB RoiArthurB reopened this Oct 17, 2022
Gama 1.9.1 automation moved this from Done to To fix Oct 17, 2022
@lesquoyb lesquoyb moved this from To fix to won't be fixed in Gama 1.9.1 Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Gama 1.9.1
  
won't be fixed
Development

No branches or pull requests

3 participants