Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,10 @@ jobs:
working-directory: packages/docs
run: bun run lint

- name: Format check
working-directory: packages/docs
run: bunx prettier --check "src/**/*.{ts,tsx,css}"

- name: Build
working-directory: packages/docs
run: bun run build
Expand Down
19 changes: 14 additions & 5 deletions packages/docs/src/components/CodeBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,12 @@ function highlightCode(element: HTMLElement, language: string) {
});

element.innerHTML = highlightedLines.join('\n');
} else if (language === 'swift' || language === 'kotlin' || language === 'dart' || language === 'gdscript') {
} else if (
language === 'swift' ||
language === 'kotlin' ||
language === 'dart' ||
language === 'gdscript'
) {
// Swift, Kotlin, and Dart syntax highlighting
const lines = text.split('\n');
const highlightedLines = lines.map((line) => {
Expand Down Expand Up @@ -217,15 +222,19 @@ function highlightCode(element: HTMLElement, language: string) {
// Language-specific keywords
let keywords: string;
if (language === 'swift') {
keywords = 'import|func|let|var|if|else|for|while|do|switch|case|return|try|await|async|class|struct|enum|protocol|extension|guard|defer|in|is|as|self|super|static|final|override|public|private|internal|fileprivate|open|weak|unowned|lazy|mutating|nonmutating|convenience|required|subscript|deinit|init|typealias|associatedtype|where|throws|rethrows|catch|throw|nil|true|false|@available';
keywords =
'import|func|let|var|if|else|for|while|do|switch|case|return|try|await|async|class|struct|enum|protocol|extension|guard|defer|in|is|as|self|super|static|final|override|public|private|internal|fileprivate|open|weak|unowned|lazy|mutating|nonmutating|convenience|required|subscript|deinit|init|typealias|associatedtype|where|throws|rethrows|catch|throw|nil|true|false|@available';
} else if (language === 'kotlin') {
keywords = 'import|package|fun|val|var|if|else|for|while|do|when|return|try|catch|finally|throw|class|object|interface|enum|sealed|data|inner|open|abstract|override|public|private|internal|protected|suspend|inline|crossinline|noinline|reified|lateinit|by|companion|init|constructor|this|super|null|true|false|it|in|is|as|typealias|where';
keywords =
'import|package|fun|val|var|if|else|for|while|do|when|return|try|catch|finally|throw|class|object|interface|enum|sealed|data|inner|open|abstract|override|public|private|internal|protected|suspend|inline|crossinline|noinline|reified|lateinit|by|companion|init|constructor|this|super|null|true|false|it|in|is|as|typealias|where';
} else if (language === 'gdscript') {
// GDScript keywords
keywords = 'func|var|const|class|class_name|extends|signal|enum|static|onready|export|preload|load|if|elif|else|for|while|match|break|continue|pass|return|await|yield|true|false|null|self|void|int|float|bool|String|Array|Dictionary|Vector2|Vector3|Object|Node|and|or|not|in|is|as';
keywords =
'func|var|const|class|class_name|extends|signal|enum|static|onready|export|preload|load|if|elif|else|for|while|match|break|continue|pass|return|await|yield|true|false|null|self|void|int|float|bool|String|Array|Dictionary|Vector2|Vector3|Object|Node|and|or|not|in|is|as';
} else {
// Dart keywords
keywords = 'import|export|library|part|show|hide|as|if|else|for|while|do|switch|case|default|break|continue|return|try|catch|finally|throw|rethrow|assert|class|abstract|extends|implements|with|mixin|enum|typedef|static|final|const|late|required|covariant|get|set|operator|factory|async|await|yield|sync|true|false|null|this|super|new|void|dynamic|var|Function|Future|Stream';
keywords =
'import|export|library|part|show|hide|as|if|else|for|while|do|switch|case|default|break|continue|return|try|catch|finally|throw|rethrow|assert|class|abstract|extends|implements|with|mixin|enum|typedef|static|final|const|late|required|covariant|get|set|operator|factory|async|await|yield|sync|true|false|null|this|super|new|void|dynamic|var|Function|Future|Stream';
}

processed = processed.replace(
Expand Down
4 changes: 1 addition & 3 deletions packages/docs/src/components/LanguageTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ function LanguageTabs({ children }: LanguageTabsProps) {
</button>
))}
</div>
<div className="language-tabs-content">
{children[activeTab]}
</div>
<div className="language-tabs-content">{children[activeTab]}</div>
</div>
);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/src/components/Pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ function Pagination({
<span key={index} className="pagination-ellipsis">
{page}
</span>
),
)
)}
</div>
)}
Expand Down
Loading
Loading