Skip to content

Commit

Permalink
v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
metonym committed Apr 23, 2021
1 parent 0e9900c commit 0757cec
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 44 deletions.
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,34 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.0](https://github.com/metonym/svelte-highlight/releases/tag/v1.0.0) - 2021-04-23

**Breaking Changes**

- upgrade `highlight.js` to version 10.7
- remove all forwarded events from `Highlight`, `HighlightSvelte`
- remove legacy component; replace with `Highlight.svelte` as the default export
- remove Rollup from build process; only ship Svelte source code and languages/styles as ESM
- remove `highlightjs-svelte` dependency; use XML/JavaScript/CSS as sublanguages

**Features**

- add `HighlightAuto` component that auto highlights code
- major bundle size improvements by using only the `core` library

**Fixes**

- correctly type languages/styles

**Other**

- drop Node.js v12 from Travis CI build config

**Documentation**

- use SvelteKit instead of Sapper for the documentation/live demo site
- provide correct NPM install command

## [0.7.1](https://github.com/metonym/svelte-highlight/releases/tag/v0.7.1) - 2021-02-13

**Fixes**
Expand Down
2 changes: 1 addition & 1 deletion demo/src/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
}

li > .code {
font-size: .75rem;
font-size: 0.75rem;
}

pre.hljs {
Expand Down
6 changes: 5 additions & 1 deletion demo/src/lib/Footer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
</Column>
<Column>
<Link class="mr-3" href="{HOMEPAGE}" target="_blank">GitHub</Link>
<Link class="mr-3" href="https://www.npmjs.com/package/{NAME}" target="_blank">NPM</Link>
<Link
class="mr-3"
href="https://www.npmjs.com/package/{NAME}"
target="_blank">NPM</Link
>
</Column>
</Row>

Expand Down
39 changes: 19 additions & 20 deletions demo/src/lib/ScopedStyleAuto.svelte
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<script>
export let name = "";
export let moduleName = "";
import HighlightAuto from "svelte-highlight/src/HighlightAuto.svelte";
import * as styles from "svelte-highlight/src/styles";
$: code = `<script>
export let name = "";
export let moduleName = "";
import HighlightAuto from "svelte-highlight/src/HighlightAuto.svelte";
import * as styles from "svelte-highlight/src/styles";
$: code = `<script>
import { HighlightAuto } from "svelte-highlight";
import ${moduleName} from "svelte-highlight/src/styles/${name}";
Expand All @@ -17,16 +17,15 @@
</svelte:head>
<HighlightAuto {code} />`;
$: css = (styles[moduleName] || "")
.replace(/\.hljs/g, `.${moduleName}.hljs`)
.replace(/\.hljs /g, `.${moduleName}.hljs`)
.replace(/\.hljs-/g, `.${moduleName} .hljs-`);
</script>

<svelte:head>
{@html css}
</svelte:head>

<HighlightAuto class="{moduleName}" code="{code}" />

$: css = (styles[moduleName] || "")
.replace(/\.hljs/g, `.${moduleName}.hljs`)
.replace(/\.hljs /g, `.${moduleName}.hljs`)
.replace(/\.hljs-/g, `.${moduleName} .hljs-`);
</script>

<svelte:head>
{@html css}
</svelte:head>

<HighlightAuto class="{moduleName}" code="{code}" />
39 changes: 19 additions & 20 deletions demo/src/lib/ScopedStyleSvelte.svelte
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<script>
export let name = "";
export let moduleName = "";
import HighlightSvelte from "svelte-highlight/src/HighlightSvelte.svelte";
import * as styles from "svelte-highlight/src/styles";
$: code = `<script>
export let name = "";
export let moduleName = "";
import HighlightSvelte from "svelte-highlight/src/HighlightSvelte.svelte";
import * as styles from "svelte-highlight/src/styles";
$: code = `<script>
import { HighlightSvelte } from "svelte-highlight";
import ${moduleName} from "svelte-highlight/src/styles/${name}";
Expand All @@ -17,16 +17,15 @@
</svelte:head>
<HighlightSvelte {code} />`;
$: css = (styles[moduleName] || "")
.replace(/\.hljs/g, `.${moduleName}.hljs`)
.replace(/\.hljs /g, `.${moduleName}.hljs`)
.replace(/\.hljs-/g, `.${moduleName} .hljs-`);
</script>

<svelte:head>
{@html css}
</svelte:head>

<HighlightSvelte class="{moduleName}" code="{code}" />

$: css = (styles[moduleName] || "")
.replace(/\.hljs/g, `.${moduleName}.hljs`)
.replace(/\.hljs /g, `.${moduleName}.hljs`)
.replace(/\.hljs-/g, `.${moduleName} .hljs-`);
</script>

<svelte:head>
{@html css}
</svelte:head>

<HighlightSvelte class="{moduleName}" code="{code}" />
6 changes: 5 additions & 1 deletion demo/svelte.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ module.exports = {
/process.env.VERSION_HLJS/g,
JSON.stringify(dependencies["highlight.js"])
)
.replace(/process.env.HOMEPAGE/g, JSON.stringify(homepage)).replace(/process.env.TS/g, JSON.stringify(new Date().toLocaleString())),
.replace(/process.env.HOMEPAGE/g, JSON.stringify(homepage))
.replace(
/process.env.TS/g,
JSON.stringify(new Date().toLocaleString())
),
};
},
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "svelte-highlight",
"version": "0.7.1",
"version": "1.0.0",
"license": "MIT",
"description": "Syntax Highlighting for Svelte using highlight.js",
"author": "Eric Liu (https://github.com/metonym)",
Expand Down

0 comments on commit 0757cec

Please sign in to comment.