-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: display title in frontmatter as heading fallback (#1556)
- Loading branch information
Showing
14 changed files
with
143 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
title: Heading Title | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "@rspress-fixture/rspress-heading-title", | ||
"version": "1.0.0", | ||
"private": true, | ||
"scripts": { | ||
"dev": "rspress dev", | ||
"build": "rspress build", | ||
"preview": "rspress preview" | ||
}, | ||
"dependencies": { | ||
"rspress": "workspace:*" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^18.11.17" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import * as path from 'node:path'; | ||
import { defineConfig } from 'rspress/config'; | ||
|
||
export default defineConfig({ | ||
root: path.join(__dirname, 'doc'), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { expect, test } from '@playwright/test'; | ||
import path from 'node:path'; | ||
import { getPort, killProcess, runDevCommand } from '../utils/runCommands'; | ||
|
||
const fixtureDir = path.resolve(__dirname, '../fixtures'); | ||
|
||
test.describe('heading-title test', async () => { | ||
let appPort; | ||
let app; | ||
test.beforeAll(async () => { | ||
const appDir = path.join(fixtureDir, 'heading-title'); | ||
appPort = await getPort(); | ||
app = await runDevCommand(appDir, appPort); | ||
}); | ||
|
||
test.afterAll(async () => { | ||
if (app) { | ||
await killProcess(app); | ||
} | ||
}); | ||
|
||
test('Guide page', async ({ page }) => { | ||
await page.goto(`http://localhost:${appPort}/guide`, { | ||
waitUntil: 'networkidle', | ||
}); | ||
const h1 = await page.$('h1'); | ||
const className = await page.evaluate(h1 => h1?.className, h1); | ||
expect(className).toContain('title_3b154'); // hash in css module should stable | ||
const text = await page.evaluate(h1 => h1?.textContent, h1); | ||
expect(text).toContain('Heading Title'); | ||
expect(await page.evaluate(h1 => h1?.id, h1)).toBe('heading-title'); | ||
expect(await page.evaluate(link => link?.hash, await h1?.$('a'))).toBe( | ||
'#heading-title', | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.