Installations
npm install svelte-prism
Developer
jakobrosenberg
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
Yes
Node Version
16.14.2
NPM Version
8.5.0
Statistics
35 Stars
39 Commits
7 Forks
2 Watching
4 Branches
3 Contributors
Updated on 07 Dec 2023
Languages
Svelte (70.09%)
JavaScript (29.91%)
Total Downloads
Cumulative downloads
Total Downloads
46,202
Last day
-94.8%
85
Compared to previous day
Last week
49.3%
5,446
Compared to previous week
Last month
441.2%
10,217
Compared to previous month
Last year
102%
22,270
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
2
Dev Dependencies
2
svelte-prism
Prebundled with Svelte language support thanks to pngwn
Install
npm i svelte-prism
Usage
1<script> 2 import Prism from 'svelte-prism' 3</script> 4 5<!-- Option one --> 6<!-- Using the source prop --> 7<Prism language="html" source="{mycode}" /> 8 9<!-- Options two --> 10<!-- Using the default slot --> 11<Prism language="html"> 12 {mycode} 13</Prism>
Inline code
Inline code can be added by adding a string inside Svelte's brackets.
1<Prism language="html"> 2 {` 3 <header> 4 <h1>Hello World!</h1> 5 </header> 6 `} 7</Prism>
Transform
Code can be transformed by using the transform prop:
1<Prism transform={x => x}>...</Prism>
Global transform can be added with:
1import { globalConfig } from 'svelte-prism' 2globalConfig.transform = x => x 3
Normalizing whitespace example
1import 'prismjs/plugins/normalize-whitespace/prism-normalize-whitespace' 2import { globalConfig } from 'svelte-prism' 3globalConfig.transform = code => Prism.plugins.NormalizeWhitespace.normalize(code)
Themes
To use a theme, import the CSS to your project. Ie.
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/themes/prism-okaidia.min.css'>
More themes can be found here https://cdnjs.com/libraries/prism
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
Found 2/25 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/main.yml:1
- Info: no jobLevel write permissions found
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/jakobrosenberg/svelte-prism/main.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/main.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/jakobrosenberg/svelte-prism/main.yml/master?enable=pin
- Info: 0 out of 1 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 third-party GitHubAction dependencies pinned
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
license file not detected
Details
- Warn: project does not have a license file
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 8 are checked with a SAST tool
Reason
21 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j
- Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22
- Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp
- Warn: Project is vulnerable to: GHSA-896r-f27r-55mw
- Warn: Project is vulnerable to: GHSA-5v2h-r2cx-5xgj
- Warn: Project is vulnerable to: GHSA-rrrm-qjm4-v8hf
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-hj9c-8jmm-8c52
- Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-x2pg-mjhr-2m5x
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-4x5v-gmq8-25ch
- Warn: Project is vulnerable to: GHSA-wv8q-r932-8hc7
- Warn: Project is vulnerable to: GHSA-8266-84wp-wv5c
- Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
Score
2.2
/10
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More