Skip to content

Commit

Permalink
Merge branch 'main' into asides-i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
delucis authored Nov 17, 2023
2 parents a33185c + 910aa0b commit 73fd8a9
Show file tree
Hide file tree
Showing 12 changed files with 256 additions and 140 deletions.
5 changes: 0 additions & 5 deletions .changeset/polite-colts-turn.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/quiet-humans-lie.md

This file was deleted.

2 changes: 2 additions & 0 deletions docs/src/content/docs/reference/overrides.md
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,8 @@ The default implementation shows a large title, tagline, and call-to-action link
Component rendered around each page’s main content.
The default implementation sets up basic styles to apply to Markdown content.

The Markdown content styles are also exposed in `@astrojs/starlight/style/markdown.css` and scoped to the `.sl-markdown-content` CSS class.

---

### Footer
Expand Down
2 changes: 1 addition & 1 deletion examples/basics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/starlight": "^0.12.0",
"@astrojs/starlight": "^0.12.1",
"astro": "^3.2.3",
"sharp": "^0.32.5"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/tailwind/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/starlight": "^0.12.0",
"@astrojs/starlight": "^0.12.1",
"@astrojs/starlight-tailwind": "^2.0.1",
"@astrojs/tailwind": "^5.0.0",
"astro": "^3.2.3",
Expand Down
12 changes: 12 additions & 0 deletions packages/starlight/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# @astrojs/starlight

## 0.12.1

### Patch Changes

- [#1069](https://github.com/withastro/starlight/pull/1069) [`b86f360`](https://github.com/withastro/starlight/commit/b86f3608f03be9455ec1d5ba11820c9bf601ad1e) Thanks [@Genteure](https://github.com/Genteure)! - Fix sidebar highlighting and navigation buttons for pages with path containing non-ASCII characters

- [#1025](https://github.com/withastro/starlight/pull/1025) [`0d1e75e`](https://github.com/withastro/starlight/commit/0d1e75e17269ddac3eb15b7dfb4480da1bb01c6c) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Internal: fix import issue in translation string loading mechanism

- [#1044](https://github.com/withastro/starlight/pull/1044) [`a5a9754`](https://github.com/withastro/starlight/commit/a5a9754f111b97abfd277d99759e9857aa0fb22b) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Fix last updated dates for pages displaying fallback content

- [#1049](https://github.com/withastro/starlight/pull/1049) [`c27495d`](https://github.com/withastro/starlight/commit/c27495da61f9376236519ed3f08a169f245a189c) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Expose Markdown content styles in `@astrojs/starlight/style/markdown.css`

## 0.12.0

### Minor Changes
Expand Down
117 changes: 117 additions & 0 deletions packages/starlight/__tests__/sidebar/navigation-unicode.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
import { describe, expect, test, vi } from 'vitest';
import { getSidebar } from '../../utils/navigation';

vi.mock('astro:content', async () =>
(await import('../test-utils')).mockedAstroContent({
docs: [
['index.mdx', { title: 'Home Page' }],
['environmental-impact.md', { title: 'Eco-friendly docs' }],
['reference/configuration.mdx', { title: 'Config Reference' }],
['reference/frontmatter.md', { title: 'Frontmatter Reference' }],
// @ts-expect-error — Using a slug not present in Starlight docs site
['api/v1/用户.md', { title: 'Path with non-ASCII characters' }],
['guides/components.mdx', { title: 'Components' }],
],
})
);

describe('getSidebar', () => {
test('matches current page when path contains non-ascii characters', () => {
expect(getSidebar('/api/v1/%E7%94%A8%E6%88%B7', undefined)).toMatchInlineSnapshot(`
[
{
"attrs": {},
"badge": undefined,
"href": "/",
"isCurrent": false,
"label": "Home",
"type": "link",
},
{
"badge": undefined,
"collapsed": false,
"entries": [
{
"attrs": {},
"badge": {
"text": "New",
"variant": "success",
},
"href": "/intro/",
"isCurrent": false,
"label": "Introduction",
"type": "link",
},
{
"attrs": {},
"badge": {
"text": "Deprecated",
"variant": "default",
},
"href": "/next-steps/",
"isCurrent": false,
"label": "Next Steps",
"type": "link",
},
{
"attrs": {
"class": "showcase-link",
"target": "_blank",
},
"badge": undefined,
"href": "/showcase/",
"isCurrent": false,
"label": "Showcase",
"type": "link",
},
],
"label": "Start Here",
"type": "group",
},
{
"badge": {
"text": "Experimental",
"variant": "default",
},
"collapsed": false,
"entries": [
{
"attrs": {},
"badge": undefined,
"href": "/reference/configuration/",
"isCurrent": false,
"label": "Config Reference",
"type": "link",
},
{
"attrs": {},
"badge": undefined,
"href": "/reference/frontmatter/",
"isCurrent": false,
"label": "Frontmatter Reference",
"type": "link",
},
],
"label": "Reference",
"type": "group",
},
{
"badge": undefined,
"collapsed": false,
"entries": [
{
"attrs": {},
"badge": undefined,
"href": "/api/v1/用户/",
"isCurrent": true,
"label": "Path with non-ASCII characters",
"type": "link",
},
],
"label": "API v1",
"type": "group",
},
]
`);
});
});
125 changes: 2 additions & 123 deletions packages/starlight/components/MarkdownContent.astro
Original file line number Diff line number Diff line change
@@ -1,127 +1,6 @@
---
import type { Props } from '../props';
import '../style/markdown.css';
---

<div class="content"><slot /></div>

<style>
.content
:global(
:not(a, strong, em, del, span, input, code)
+ :not(a, strong, em, del, span, input, code, :where(.not-content *))
) {
margin-top: 1.5rem;
}

/* Headings after non-headings have more spacing. */
.content
:global(
:not(h1, h2, h3, h4, h5, h6) + :is(h1, h2, h3, h4, h5, h6):not(:where(.not-content *))
) {
margin-top: 2.5rem;
}

.content :global(li + li:not(:where(.not-content *))),
.content :global(dt + dt:not(:where(.not-content *))),
.content :global(dt + dd:not(:where(.not-content *))),
.content :global(dd + dd:not(:where(.not-content *))) {
margin-top: 0.25rem;
}

.content
:global(
li > :last-child:not(li, ul, ol):not(a, strong, em, del, span, input, :where(.not-content *))
) {
margin-bottom: 1.25rem;
}

.content :global(dt:not(:where(.not-content *))) {
font-weight: 700;
}
.content :global(dd:not(:where(.not-content *))) {
padding-inline-start: 1rem;
}

.content :global(:is(h1, h2, h3, h4, h5, h6):not(:where(.not-content *))) {
color: var(--sl-color-white);
line-height: var(--sl-line-height-headings);
font-weight: 600;
}

.content :global(:is(img, picture, video, canvas, svg, iframe):not(:where(.not-content *))) {
display: block;
max-width: 100%;
height: auto;
}

.content :global(h1:not(:where(.not-content *))) {
font-size: var(--sl-text-h1);
}
.content :global(h2:not(:where(.not-content *))) {
font-size: var(--sl-text-h2);
}
.content :global(h3:not(:where(.not-content *))) {
font-size: var(--sl-text-h3);
}
.content :global(h4:not(:where(.not-content *))) {
font-size: var(--sl-text-h4);
}
.content :global(h5:not(:where(.not-content *))) {
font-size: var(--sl-text-h5);
}
.content :global(h6:not(:where(.not-content *))) {
font-size: var(--sl-text-h6);
}

.content :global(a:not(:where(.not-content *))) {
color: var(--sl-color-text-accent);
}
.content :global(a:hover:not(:where(.not-content *))) {
color: var(--sl-color-white);
}

.content :global(code:not(:where(.not-content *))) {
background-color: var(--sl-color-bg-inline-code);
margin-block: -0.125rem;
padding: 0.125rem 0.375rem;
font-size: var(--sl-text-code-sm);
}
.content :global(:is(h1, h2, h3, h4, h5, h6) code) {
font-size: inherit;
}

.content :global(pre:not(:where(.not-content *))) {
border: 1px solid var(--sl-color-gray-5);
padding: 0.75rem 1rem;
font-size: var(--sl-text-code);
tab-size: 2;
}

.content :global(pre code:not(:where(.not-content *))) {
all: unset;
font-family: var(--__sl-font-mono);
}

.content :global(blockquote:not(:where(.not-content *))) {
border-inline-start: 1px solid var(--sl-color-gray-5);
padding-inline-start: 1rem;
}

.content :global(table:not(:where(.not-content *))) {
display: block;
overflow: auto;
border-collapse: collapse;
}
.content :global(tr:nth-child(2n):not(:where(.not-content *))) {
background-color: var(--sl-color-gray-7, var(--sl-color-gray-6));
}
.content :global(:is(th, td):not(:where(.not-content *))) {
border: 1px solid var(--sl-color-hairline-light);
padding: 0.375rem 0.8125rem;
}

.content :global(hr:not(:where(.not-content *))) {
border: 0;
border-bottom: 1px solid var(--sl-color-hairline);
}
</style>
<div class="sl-markdown-content"><slot /></div>
5 changes: 3 additions & 2 deletions packages/starlight/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@astrojs/starlight",
"version": "0.12.0",
"version": "0.12.1",
"description": "Build beautiful, high-performance documentation websites with Astro",
"scripts": {
"test": "vitest",
Expand Down Expand Up @@ -158,7 +158,8 @@
"./schema": "./schema.ts",
"./types": "./types.ts",
"./index.astro": "./index.astro",
"./404.astro": "./404.astro"
"./404.astro": "./404.astro",
"./style/markdown.css": "./style/markdown.css"
},
"peerDependencies": {
"astro": "^3.2.0"
Expand Down
Loading

0 comments on commit 73fd8a9

Please sign in to comment.