-
Notifications
You must be signed in to change notification settings - Fork 141
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
Update Tact language syntax for prism.js #288
Comments
oh, it's already completed, found in the history of TON Docs: UPD: it's outdated, we need new version |
Ready to work on it — please, assign me to this footstep. P.S.: I was recently researching some lexers/parsers for a couple of languages, Tact looks quite familiar in that regard :) |
@novusnota hi! Just assigned you. Good luck and don’t forget to share your progress here! |
@Gusarich great! sure thing :) |
@novusnota here is a useful link for you to build a parser: https://github.com/tact-lang/tact/blob/main/src/grammar/grammar.ohm |
wow waiting this improvement |
@Gusarich @SwiftAdviser @jojudre Almost there, here's a small snippet (doesn't actually exist on the website, it's just me testing locally), Color theme on ton-docs doesn't color much (see |
Awesome!
Awesome! |
Done and lookin' good: PR to ton-docs: feat: Updated Tact language highlighting for Prism.js The second one would be reviewed and merged as they release Prism.js v2 ✌ TON wallet address for reward: |
@reveloper @SwiftAdviser, please make a review for documentation so that we can fully complete this footstep. |
@delovoyhomie Ok, will do it ASAP. |
@SwiftAdviser @reveloper, Is it looks good to you? |
@delovoyhomie |
@reveloper here's the sample I used on the screenshot above: import "@stdlib/ownable";
struct SampleStruct {
message: Int as uint32;
}
message(0x1234) MyMessage {
data: SampleStruct;
}
trait MyTrait {
get fun traitState(): Int {
return 0;
}
}
contract MyContract with MyTrait, Ownable? {
owner: Address; // comment
value: Int as uint32 = 1230;
counters: map<Int, Address> /* Address, "Address" */ ;
map: map<Int as int16, Int as uint32>;
b: bounced<MyMessage>;
init(owner: Address) {
self.owner = owner;
}
bounced() {}
virtual fun overrideMe() {}
}
mutates get fun noName() { /* Multi-line comment */ } |
@novusnota, @delovoyhomie I checked locally with several Tact contracts, have no find issues according to footstep task, LGTM. One note to think about, for me Italic style for keywords( Perhaps this should be reconsider as separate update or declined (depending on dev community thoughts). |
@reveloper Fully agree, but this italic style is due to the particular prism.js theme currently in the use on tl;dr: one should find a common theme used on |
@reveloper Something like that? Idk where does current colors for the highlighting come from, though. Dracula color theme blocks show up unused in the docusaurus.config.js#L5. So I've colored var token = document.querySelectorAll('span.token.keyword');
token.forEach(t => t.style = "color: rgb(245, 110, 108);"); |
how about the code here we prepared for NFT standard:
|
@howardpen9 whoa, you've submitted quite a chunk of code :) So, I took it, pasted it to the current Whew, I hope it's not too much. |
After digging in the docs of Docusaurus, various color schemes and ton-docs, I now can make the proper change to the code highlighting theme in code blocks of TON documentation (as an extra bonus to this footstep :) But first, let's collectively decide on the colors for Tact — please, pick between the two color options: left (closer to the theme in Tact docs), or right (closer to the original theme, Palenight), and I'll send the relevant PR to ton-docs. Vote 🚀 for left, and 🎉 for right: And how FunC looks with adjustments made across the docs, same left 🚀 or right 🎉 vote: Note, that current Prism.js syntax of FunC & Fift regardless of what you choose above is quite incomplete. @SwiftAdviser, I'd volunteer to update those both for $200 as part of an another footstep, if necessary. |
Rewards sent! Thank you for the contribution. |
Summary
Update syntax highlighting support for the Tact language in prism.js
Context
Prism.js is a popular syntax highlighting library used for code snippets. However, support for the Tact language has outdated syntax. The Tact language is gaining traction and being used in various projects, including the ton.org/dev and docs.ton.org website. Therefore, it is necessary to add syntax highlighting support for the Tact language in prism.js.
Currently, we already have syntax highlight for prism.js, but it's outdated:
https://github.com/ton-community/ton-docs/blob/278493f6e1debad7f370924c6d1241ad14a2eba2/src/theme/prism/prism-tact.js#L4
Useful links:
Goals
Deliverables
Definition of Done
Reward
Total: $300
Oriental Release Date
30.08.23
The text was updated successfully, but these errors were encountered: