PrismJS / PrismJS/prism

Astro framework Components

Open
#3,718 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

language-definitions new language
Dominant language
JavaScript
Stars
13k
Forks
1.4k
Avg merge
15h 36m
Merged PRs (30d)
3

Description

Language
Astro Component consists of two parts

---
// here goes typescript syntax
---

<!-- here goes jsx-like syntax -->

Within jsx-like part all <script> elements contain Typescript, except for those which are marked as is:inline

Example:

---
type Props = { url: string, label: string, list: string[] }
const { list } = Astro.props
---

<a href={Astro.props.url}>{Astro.props.label}</a>
{list.length > 0 ? list.map(e => <p>{e}</p>) : null}

<script>
// this is typescript
import AnchorBeautifier from 'my-lib';
import type { BeautifulAnchor } from 'my-lib';
const allLinks: BeautifulAnchor[]  = []
document.querySelectorAll("a").forEach(
  anchor => {
    allLinks.push(AnchorBeautifier.beautify(anchor))
  }
)
console.log("processed links", allLinks)
</script>

<script is:inline>
// this is javascript
...
</script is:inline>

Additional resources

  • website
  • components doc
  • I have also noticed that there is no highlighting for Vue, which has similar structure. I suspect there might be some technical limitation (I am not aware of Prism's architecture)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue provides Astro component examples and links to the Astro components documentation, but no repository file or test entry point. Start by reading those examples and Prism's existing language-support structure; done means Astro components highlight TypeScript in frontmatter and regular script elements while preserving JavaScript for scripts marked is:inline.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
devtools
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.