Skip to content

Commit 4914c6a

Browse files
committed
fix: Use Rust syntax highlighting for LUMOS code blocks
Changed all ```lumos code blocks to ```rust for proper syntax highlighting. LUMOS syntax is very similar to Rust, so Rust highlighting provides: - Colorful keywords (#[solana], struct, enum, etc.) - Type highlighting (u64, PublicKey, Option<T>) - Comment highlighting - String highlighting This fixes the monochrome code blocks issue where all text appeared in the same gray color. Affected files: - api/cli-commands.md - api/types.md - api/attributes.md - getting-started/quick-start.md
1 parent 5a75d1a commit 4914c6a

File tree

5 files changed

+35
-35
lines changed

5 files changed

+35
-35
lines changed

src/content/docs/api/attributes.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Marks a type as Solana-specific, enabling Solana type support (`PublicKey`, `Sig
2222

2323
### Syntax
2424

25-
```lumos
25+
```rust
2626
#[solana]
2727
struct TypeName {
2828
// fields
@@ -81,7 +81,7 @@ export const TypeNameBorshSchema = borsh.struct([
8181

8282
#### Simple Solana Struct
8383

84-
```lumos
84+
```rust
8585
#[solana]
8686
struct Account {
8787
owner: PublicKey,
@@ -103,7 +103,7 @@ pub struct Account {
103103

104104
#### Solana Enum
105105

106-
```lumos
106+
```rust
107107
#[solana]
108108
enum TransactionType {
109109
Transfer(PublicKey, u64),
@@ -127,7 +127,7 @@ pub enum TransactionType {
127127

128128
#### Non-Solana Type (No Attribute)
129129

130-
```lumos
130+
```rust
131131
struct GenericData {
132132
id: u64,
133133
value: String,
@@ -165,7 +165,7 @@ Generates Anchor's `#[account]` macro for on-chain account data.
165165

166166
### Syntax
167167

168-
```lumos
168+
```rust
169169
#[solana]
170170
#[account]
171171
struct AccountName {
@@ -181,7 +181,7 @@ struct AccountName {
181181

182182
#### With `#[account]`
183183

184-
```lumos
184+
```rust
185185
#[solana]
186186
#[account]
187187
struct PlayerAccount {
@@ -211,7 +211,7 @@ pub struct PlayerAccount {
211211

212212
#### Without `#[account]`
213213

214-
```lumos
214+
```rust
215215
#[solana]
216216
struct EventData {
217217
player: PublicKey,
@@ -254,7 +254,7 @@ impl borsh::BorshDeserialize for EventData { /* ... */ }
254254

255255
#### Player Account (On-Chain Storage)
256256

257-
```lumos
257+
```rust
258258
#[solana]
259259
#[account]
260260
struct PlayerAccount {
@@ -299,7 +299,7 @@ pub struct CreatePlayer<'info> {
299299

300300
#### Match Result (Event Data, Not Stored)
301301

302-
```lumos
302+
```rust
303303
#[solana]
304304
struct MatchResult {
305305
winner: PublicKey,
@@ -333,7 +333,7 @@ pub mod game {
333333

334334
### Valid Combinations
335335

336-
```lumos
336+
```rust
337337
// ✅ Both attributes (on-chain account)
338338
#[solana]
339339
#[account]
@@ -351,7 +351,7 @@ struct Data { /* ... */ }
351351

352352
### Invalid Combinations
353353

354-
```lumos
354+
```rust
355355
// ❌ #[account] without #[solana]
356356
#[account]
357357
struct Account { /* ... */ }
@@ -372,7 +372,7 @@ LUMOS intelligently detects when to use Anchor imports based on attributes in th
372372

373373
### Example: Mixed Module
374374

375-
```lumos
375+
```rust
376376
// File: schema.lumos
377377

378378
#[solana]
@@ -438,7 +438,7 @@ LUMOS chooses imports based on attributes:
438438

439439
:::tip[Use #[account] for Persistent Data]
440440
If data is stored on-chain in a PDA or account, use `#[account]`:
441-
```lumos
441+
```rust
442442
#[solana]
443443
#[account]
444444
struct UserProfile { /* ... */ }
@@ -447,7 +447,7 @@ struct UserProfile { /* ... */ }
447447

448448
:::tip[Omit #[account] for Events]
449449
Events are emitted, not stored:
450-
```lumos
450+
```rust
451451
#[solana]
452452
struct TransferEvent { /* ... */ }
453453
```
@@ -459,7 +459,7 @@ Put attributes in this order:
459459
2. `#[account]` (if needed)
460460
3. Type definition
461461

462-
```lumos
462+
```rust
463463
#[solana]
464464
#[account]
465465
struct Account { /* ... */ }
@@ -484,7 +484,7 @@ cannot find type `Pubkey` in this scope
484484
```
485485

486486
**Fix:** Add `#[solana]` attribute:
487-
```lumos
487+
```rust
488488
#[solana] // ← Add this
489489
struct Account {
490490
owner: PublicKey,
@@ -501,7 +501,7 @@ struct Account {
501501
```
502502

503503
**Fix:** Add `#[solana]` before `#[account]`:
504-
```lumos
504+
```rust
505505
#[solana] // ← Add this
506506
#[account]
507507
struct Account { /* ... */ }
@@ -517,7 +517,7 @@ cannot derive `BorshSerialize` when #[account] is present
517517
```
518518

519519
**Fix:** Remove manual derives - Anchor handles serialization:
520-
```lumos
520+
```rust
521521
// ❌ Don't do this
522522
#[solana]
523523
#[account]

src/content/docs/api/cli-commands.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ my-solana-app/
210210
```
211211

212212
**`schema.lumos` (example):**
213-
```lumos
213+
```rust
214214
#[solana]
215215
#[account]
216216
struct PlayerAccount {

src/content/docs/api/types.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ LUMOS supports a rich type system that maps cleanly between Rust and TypeScript.
3434

3535
### Unsigned Integers
3636

37-
```lumos
37+
```rust
3838
#[solana]
3939
struct Numbers {
4040
tiny: u8, // 0 to 255
@@ -77,7 +77,7 @@ For `u64` values larger than this, precision may be lost. Use `bigint` carefully
7777

7878
### Signed Integers
7979

80-
```lumos
80+
```rust
8181
#[solana]
8282
struct SignedNumbers {
8383
tiny: i8, // -128 to 127
@@ -96,7 +96,7 @@ struct SignedNumbers {
9696

9797
### Boolean
9898

99-
```lumos
99+
```rust
100100
#[solana]
101101
struct Flags {
102102
is_active: bool,
@@ -112,7 +112,7 @@ struct Flags {
112112

113113
### String
114114

115-
```lumos
115+
```rust
116116
#[solana]
117117
struct Metadata {
118118
name: String,
@@ -144,7 +144,7 @@ Keep strings short for efficient on-chain storage.
144144

145145
Represents a Solana public key (32 bytes).
146146

147-
```lumos
147+
```rust
148148
#[solana]
149149
struct Account {
150150
owner: PublicKey,
@@ -186,7 +186,7 @@ export const AccountBorshSchema = borsh.struct([
186186

187187
Represents a Solana signature (64 bytes).
188188

189-
```lumos
189+
```rust
190190
#[solana]
191191
struct Transaction {
192192
signature: Signature,
@@ -219,7 +219,7 @@ export const TransactionBorshSchema = borsh.struct([
219219

220220
Dynamic-length arrays.
221221

222-
```lumos
222+
```rust
223223
#[solana]
224224
struct Inventory {
225225
items: [PublicKey],
@@ -267,7 +267,7 @@ For 100 PublicKeys: 4 + (32 × 100) = 3,204 bytes
267267

268268
Nullable fields.
269269

270-
```lumos
270+
```rust
271271
#[solana]
272272
struct Profile {
273273
username: String,
@@ -316,7 +316,7 @@ Rust-style enums with three variant types.
316316

317317
### Unit Variants
318318

319-
```lumos
319+
```rust
320320
#[solana]
321321
enum Status {
322322
Active,
@@ -358,7 +358,7 @@ export const StatusBorshSchema = borsh.rustEnum([
358358

359359
### Tuple Variants
360360

361-
```lumos
361+
```rust
362362
#[solana]
363363
enum Event {
364364
UserJoined(PublicKey),
@@ -394,7 +394,7 @@ export const EventBorshSchema = borsh.rustEnum([
394394

395395
### Struct Variants
396396

397-
```lumos
397+
```rust
398398
#[solana]
399399
enum Instruction {
400400
Initialize {
@@ -459,7 +459,7 @@ The following types are **NOT** supported:
459459
### Workarounds
460460

461461
**Fixed-size arrays → Vec:**
462-
```lumos
462+
```rust
463463
// ❌ Not supported
464464
struct Data {
465465
buffer: [u8; 1024],
@@ -472,7 +472,7 @@ struct Data {
472472
```
473473

474474
**Tuples → Struct:**
475-
```lumos
475+
```rust
476476
// ❌ Not supported
477477
struct Pair {
478478
data: (u64, String),
@@ -507,7 +507,7 @@ For large `u64` values, consider:
507507

508508
:::tip[Use Option for Nullable Fields]
509509
Always use `Option<T>` for optional values:
510-
```lumos
510+
```rust
511511
struct User {
512512
name: String,
513513
email: Option<String>, // Not all users have email

src/content/docs/getting-started/introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const GameStateBorshSchema = borsh.struct([
5656

5757
### With LUMOS
5858

59-
```lumos
59+
```rust
6060
#[solana]
6161
struct GameState {
6262
player: PublicKey,

src/content/docs/getting-started/quick-start.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ my-game/
6565

6666
Open `schema.lumos` and define your data structures:
6767

68-
```lumos
68+
```rust
6969
#[solana]
7070
#[account]
7171
struct PlayerAccount {

0 commit comments

Comments
 (0)