Skip to content

docs: add Astro language documentation#905

Merged
hatemhosny merged 5 commits into
live-codes:developfrom
nhussein2026:add-astro-docs
Oct 18, 2025
Merged

docs: add Astro language documentation#905
hatemhosny merged 5 commits into
live-codes:developfrom
nhussein2026:add-astro-docs

Conversation

@nhussein2026

@nhussein2026 nhussein2026 commented Oct 18, 2025

Copy link
Copy Markdown
Contributor

What type of PR is this? (check all applicable)

  • 📝 Documentation Update

Description

This PR adds documentation for the Astro framework under the supported languages section.
It explains both Static (pre-rendered) and Dynamic (server-rendered) modes, includes configuration examples, language details, and usage snippets.
The content follows the same structure and style as the existing art-template documentation to maintain consistency across language docs.

Related Tickets & Documents

Fixes #769
#769

Mobile & Desktop Screenshots/Recordings

No visual changes.

Added tests?

  • 👍 yes
  • 🙅 no, because they aren't needed (documentation only)

Added to documentations?

  • 📓 docs (./docs)

[optional] Are there any post-deployment tasks we need to perform?

None.

[optional] What gif best describes this PR or how it makes you feel?

Mind Blown

Summary by CodeRabbit

  • Documentation

    • Expanded Astro language docs with full usage guides (static & dynamic), configuration and formatting examples, custom settings, example snippets, and links to official resources.
  • Chores

    • Standardized starter template metadata and dynamic title handling across languages for consistency.
    • Harmonized template UI text, initial states, and input/output presentation for a smoother starter experience.

@coderabbitai

coderabbitai Bot commented Oct 18, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Added a complete Astro language documentation page and updated multiple starter templates to use dynamic title generation and refine DOM/input/output/button handling within template scripts. No public API changes.

Changes

Cohort / File(s) Summary
Language documentation
docs/docs/languages/astro.mdx
Replaced placeholder content with a full Astro language documentation entry: Usage (Static & Dynamic), Language Info, Code Formatting, Custom Settings, Example Usage (Static/Dynamic), configuration snippets, and Official Resources.
Starter template updates
Templates data
functions/vendors/templates.js
Normalized and refactored starter template metadata and content: switched some templates to dynamic title generation via getTemplateName, adjusted inline DOM text updates, input/output parsing (trim vs direct assignment), initial button states and labels, and whitespace/formatting within embedded scripts. Exported starterTemplates remains exported with updated string content.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as User
  participant UI as Template UI
  participant TS as Template Script
  participant DOM as Output/Buttons

  U->>UI: enter input / click Run
  UI->>TS: pass input (trimmed/normalized)
  alt successful run
    TS->>DOM: update output text
    TS->>DOM: set button state ("Run" -> "Running" -> "Run")
  else error
    TS->>DOM: display error message
    TS->>DOM: reset button state
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

"I nibbled through the docs and code today,
Titles sprouted fresh, buttons learned to play,
Astro now sings with examples bright,
Templates tidy, outputs right—
A cheerful hop and on my way."

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Out of Scope Changes Check ⚠️ Warning Changes to functions/vendors/templates.js appear to extend beyond the stated scope of this PR. While the PR is described as a documentation-only change adding Astro documentation, the template file modifications include updates to template metadata and title generation logic for multiple languages (C++ Wasm, Go Wasm, and Go), DOM interaction adjustments, and input/output handling modifications. These changes affect template infrastructure across several languages rather than being limited to supporting the Astro documentation addition, suggesting they may represent unrelated refactoring work that should be addressed in a separate PR. Consider moving the template changes in functions/vendors/templates.js to a separate PR focused on template infrastructure refactoring. If these changes are necessary dependencies for the Astro documentation, clarify their relationship and document why they're needed in the PR description. Alternatively, restrict the PR to documentation-only changes as originally stated, keeping the template modifications separate.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "docs: add Astro language documentation" is clear and specific, accurately describing the primary change of adding comprehensive Astro framework documentation to the supported languages section. The title directly corresponds to the main file modification (docs/docs/languages/astro.mdx), which includes structured sections for Static and Dynamic usage modes, configuration examples, and language details. This aligns well with the PR's stated objective of addressing the Astro entry in issue #769.
Linked Issues Check ✅ Passed The PR successfully addresses the primary objective of linked issue #769 by adding comprehensive documentation for Astro to the language documentation page. The changes include structured sections covering Static and Dynamic rendering modes, language information, code formatting, custom settings, usage examples, and official resources—directly fulfilling the requirement to populate the missing Astro language documentation. While reviewer feedback suggests refinements to the dynamic example code and additional context about the Astro compiler version used in LiveCodes, the core requirement to add Astro documentation has been met.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@netlify

netlify Bot commented Oct 18, 2025

Copy link
Copy Markdown

Deploy Preview for livecodes ready!

Name Link
🔨 Latest commit c5d0035
🔍 Latest deploy log https://app.netlify.com/projects/livecodes/deploys/68f3d1002ef2f00008a98875
😎 Deploy Preview https://deploy-preview-905--livecodes.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
functions/vendors/templates.js (1)

1326-1353: Simplified to stdin/stdout pattern but removed goroutine demo.

The rewritten Go code effectively demonstrates stdin/stdout interaction with WASM, making it simpler and more focused. However, the original version included a goroutine example (go greet() at line 1166) that demonstrated Go's concurrency features working in WASM, which was a valuable learning point.

Consider whether the goroutine demonstration should be preserved in a comment or additional example section.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7344c78 and 8022516.

📒 Files selected for processing (2)
  • docs/docs/languages/astro.mdx (1 hunks)
  • functions/vendors/templates.js (8 hunks)
🔇 Additional comments (11)
docs/docs/languages/astro.mdx (5)

1-2: LGTM! Clear and accurate introduction.

The description accurately captures Astro's core philosophy and architecture.


52-59: LGTM! Well-structured language metadata.

The language information section provides clear and useful metadata for developers.


62-84: LGTM! Clear formatting and configuration guidance.

The sections provide accurate information about code formatting and configuration options.


87-106: LGTM! Clear and practical examples.

Both static and dynamic examples effectively demonstrate Astro's core patterns.


110-117: All external links verified and accessible.

The Official Resources section passes verification. All five links (documentation, GitHub repository, StackBlitz playground, blog, and Discord community) are live and accessible.

functions/vendors/templates.js (6)

696-696: LGTM! Consistency fix for template formatting.

Adding .trimStart() ensures consistent whitespace handling across all templates.


1199-1199: LGTM! More descriptive title.

Changing the title from a generic greeting to "Go (Wasm)" immediately clarifies the technology being demonstrated.


1232-1255: LGTM! Well-structured WASM interaction pattern.

The JavaScript code properly demonstrates stdin/stdout interaction with Go WebAssembly, including proper async handling and error checking.


1474-1474: LGTM! Consistency fix.

Adding .trimStart() maintains consistency with other templates.


1646-1646: LGTM! Consistency fixes for Jest and jQuery templates.

Adding .trimStart() to both templates maintains consistency across the codebase.

Also applies to: 1672-1672


3956-3956: LGTM! Final consistency fix.

Completes the pattern of ensuring all template content strings properly call .trimStart().

Comment thread docs/docs/languages/astro.mdx Outdated
Comment thread docs/docs/languages/astro.mdx
@hatemhosny

Copy link
Copy Markdown
Collaborator

Thank you, @nhussein2026

Please change the dynamic example to something like this, since LiveCodes currently does not support files (e.g. src/pages/api/hello.js):

---
const res = await fetch('https://jsonplaceholder.typicode.com/users/1');
const data = await res.json();
---
<h1>Hello {data.name}!</h1>

Also, LiveCodes uses a relatively old Astro compiler v0.9.2

You may want to add a link to Astro starter template

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (1)
docs/docs/languages/astro.mdx (1)

33-49: Clarify: API endpoint example may not work in LiveCodes; align with reviewer feedback.

The past review feedback noted that "LiveCodes does not support project files (e.g., src/pages/api/)" and suggested focusing on an inline Astro example instead. While the inline fetch example (lines 43–49) correctly implements the suggestion, the API endpoint example (lines 33–39) preceding it documents a pattern that won't execute in LiveCodes.

Consider either:

  1. Removing the API endpoint section entirely and keeping only the inline example (lines 43–49), or
  2. Clarifying that the endpoint pattern is for reference but won't work in LiveCodes' current constraints.
🧹 Nitpick comments (1)
docs/docs/languages/astro.mdx (1)

59-61: Minor: Clarify version information positioning.

The "Version: Latest (v4.x and above)" (line 59) is immediately followed by a caveat that LiveCodes uses v0.9.2. While the warning is present, the placement can confuse readers who see "Latest" and only later discover the actual version constraint.

Consider reframing line 59 to "Version: v0.9.2 (Docs for v4.x)" or moving the caveat warning earlier in the Language Info section for better clarity.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0f826f7 and 470cfc6.

📒 Files selected for processing (1)
  • docs/docs/languages/astro.mdx (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Redirect rules - livecodes
  • GitHub Check: Header rules - livecodes
  • GitHub Check: Pages changed - livecodes
🔇 Additional comments (1)
docs/docs/languages/astro.mdx (1)

90-122: Documentation structure and examples look solid.

The Example Usage and Official Resources sections are well-organized, include appropriate static and dynamic examples, and provide comprehensive resource links including the LiveCodes starter template. Code formatting is consistent, and examples are practical.

@hatemhosny

Copy link
Copy Markdown
Collaborator

Thank you @nhussein2026
Please keep up the great contributions

@hatemhosny hatemhosny enabled auto-merge October 18, 2025 16:43
@sonarqubecloud

Copy link
Copy Markdown

@hatemhosny hatemhosny merged commit e33da45 into live-codes:develop Oct 18, 2025
16 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add missing language docs

2 participants