Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: line numbers when at end of meta tags #229

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
"**/package-lock.json": true
},
"files.exclude": {
".zed": true,
".turbo": true,
"**/*.timestamp-*": true
},
"[markdown]": {
Expand Down
1 change: 1 addition & 0 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
"useAwait": "off",
"noConsoleLog": "off",
"noExplicitAny": "off",
"noFocusedTests": "off",
"noEmptyInterface": "off",
"noConfusingVoidType": "off"
},
Expand Down
12 changes: 8 additions & 4 deletions docs/astro.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import {
rehypePrettyCode,
type RehypePrettyCodeOptions,
} from 'rehype-pretty-code';
import {
transformerNotationDiff,
transformerNotationFocus,
Expand All @@ -11,11 +15,11 @@ import {
} from '@shikijs/transformers';
import remarkToc from 'remark-toc';
import rehypeSlug from 'rehype-slug';
import type { RawTheme } from 'shiki';
import tailwind from '@astrojs/tailwind';
import starlight from '@astrojs/starlight';
import { defineConfig } from 'astro/config';
import remarkSmartypants from 'remark-smartypants';
import { rehypePrettyCode } from 'rehype-pretty-code';
import { rehypeHeadingIds } from '@astrojs/markdown-remark';
import rehypeAutolinkHeadings from 'rehype-autolink-headings';
import { transformerCopyButton } from '@rehype-pretty/transformers';
Expand Down Expand Up @@ -55,14 +59,14 @@ export default defineConfig({
rehypePrettyCode,
{
keepBackground: true,
theme: moonlightTheme,
theme: moonlightTheme as unknown as RawTheme,
transformers: [
transformerCopyButton({
visibility: 'always',
visibility: 'hover',
feedbackDuration: 2_500,
}),
],
},
} satisfies RehypePrettyCodeOptions,
],
rehypeSlug,
],
Expand Down
12 changes: 6 additions & 6 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,26 @@
},
"dependencies": {
"@astrojs/mdx": "^3.1.2",
"@astrojs/starlight": "^0.24.4",
"@astrojs/starlight": "^0.24.5",
"@astrojs/starlight-tailwind": "^2.0.3",
"@astrojs/tailwind": "^5.1.0",
"@rehype-pretty/transformers": "workspace:*",
"astro": "^4.11.1",
"astro": "^4.11.5",
"rehype-autolink-headings": "^7.1.0",
"rehype-pretty-code": "workspace:*",
"rehype-slug": "^6.0.0",
"rehype-stringify": "^10.0.0",
"remark-toc": "^9.0.0",
"sharp": "^0.33.4",
"shiki": "^1.9.1",
"shiki": "^1.10.1",
"tailwindcss": "^3.4.4"
},
"devDependencies": {
"@astrojs/check": "^0.7.0",
"@shikijs/transformers": "^1.9.1",
"@shikijs/twoslash": "^1.9.1",
"@shikijs/transformers": "^1.10.1",
"@shikijs/twoslash": "^1.10.1",
"@total-typescript/ts-reset": "^0.5.1",
"@types/node": "^20.14.9",
"typescript": "^5.5.2"
"typescript": "^5.5.3"
}
}
6 changes: 2 additions & 4 deletions docs/src/styles/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pre {
}

code {
@apply text-sm md:text-base !leading-loose;
@apply !leading-loose;
}

pre > code {
Expand Down Expand Up @@ -163,9 +163,7 @@ code,
figure {
@apply overflow-x-auto;
}
p {
@apply text-lg;
}

article p {
@apply leading-9;
}
14 changes: 12 additions & 2 deletions docs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
{
"extends": ["astro/tsconfigs/strictest"],
"compilerOptions": {
"strict": true,
"allowJs": true,
"checkJs": true,
"target": "ESNext",
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"module": "ESNext",
"moduleResolution": "Bundler"
"alwaysStrict": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"moduleResolution": "Bundler",
"allowArbitraryExtensions": true,
"noUncheckedIndexedAccess": true,
"allowImportingTsExtensions": true,
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"noPropertyAccessFromIndexSignature": true
},
"include": ["src"],
"files": ["astro.config.ts", "tailwind.config.ts", "reset.d.ts"]
Expand Down
6 changes: 3 additions & 3 deletions examples/astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
"@astrojs/mdx": "^3.1.2",
"@astrojs/tailwind": "^5.1.0",
"@rehype-pretty/transformers": "workspace:*",
"astro": "^4.11.1",
"astro": "^4.11.5",
"rehype-pretty-code": "workspace:*",
"shiki": "^1.9.1",
"shiki": "^1.10.1",
"tailwindcss": "^3.4.4"
},
"devDependencies": {
"@astrojs/check": "^0.7.0",
"@types/node": "^20.14.9",
"typescript": "^5.5.2"
"typescript": "^5.5.3"
}
}
2 changes: 1 addition & 1 deletion examples/astro/src/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ code[data-line-numbers] > [data-line]::before {
}

pre [data-line] {
@apply px-4 border-l-2 border-l-transparent;
@apply px-1.5 border-l-2 border-l-transparent;
}

[data-highlighted-line] {
Expand Down
2 changes: 1 addition & 1 deletion examples/astro/src/pages/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ layout: '../layouts/BaseLayout.astro'

### With title, line numbers, and character highlighting

```elixir title="fib.ex" showLineNumbers /palindrome/#v
```elixir title="fib.ex" /palindrome/#v showLineNumbers
defmodule Solution do
@spec is_palindrome(x :: integer) :: boolean
def is_palindrome(x) when x < 0, do: false
Expand Down
6 changes: 3 additions & 3 deletions examples/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@
"@tailwindcss/typography": "^0.5.13",
"autoprefixer": "^10.4.19",
"next": "^14.2.4",
"postcss": "^8.4.38",
"postcss": "^8.4.39",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"rehype-pretty-code": "workspace:*",
"rehype-slug": "^6.0.0",
"rehype-stringify": "^10.0.0",
"shiki": "^1.9.1",
"shiki": "^1.10.1",
"tailwindcss": "^3.4.4"
},
"devDependencies": {
"@types/mdx": "^2.0.13",
"@types/node": "^20.14.9",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"typescript": "^5.5.2"
"typescript": "^5.5.3"
},
"browserslist": ["> 0.5%", "not dead", "not op_mini all"],
"sideEffects": false
Expand Down
14 changes: 7 additions & 7 deletions examples/sveltekit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "example-svelte",
"version": "0.0.0",
"private": true,
"type": "module",
"scripts": {
"dev": "vite dev",
"build": "vite build",
Expand All @@ -20,14 +21,13 @@
},
"devDependencies": {
"@sveltejs/adapter-static": "^3.0.2",
"@sveltejs/kit": "^2.5.17",
"@sveltejs/kit": "^2.5.18",
"@sveltejs/vite-plugin-svelte": "^3.1.1",
"magic-string": "^0.30.10",
"svelte": "5.0.0-next.166",
"svelte-check": "^3.8.2",
"svelte": "5.0.0-next.173",
"svelte-check": "^3.8.4",
"tslib": "^2.6.3",
"typescript": "^5.5.2",
"vite": "^5.3.1"
},
"type": "module"
"typescript": "^5.5.3",
"vite": "^5.3.3"
}
}
4 changes: 2 additions & 2 deletions examples/sveltekit/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import { defineConfig } from 'vite';
import tailwindcss from '@tailwindcss/vite';
import { sveltekit } from '@sveltejs/kit/vite';

export default defineConfig(() => ({
export default defineConfig({
plugins: [sveltekit(), tailwindcss()],
}));
});
31 changes: 18 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"scripts": {
"build": "turbo build",
"dev": "turbo dev",
"test": "vitest --run",
"test": "turbo test",
"format": "biome format . --error-on-warnings --log-level='info' --diagnostic-level='info' --write",
"lint": "biome lint . --log-level='info' --log-kind='pretty' --diagnostic-level='info' --apply-unsafe",
"format:markdown": "markdownlint-cli2 '**/*.md' '#**/node_modules' '#**/test'",
Expand All @@ -18,20 +18,30 @@
"changeset:publish": "changeset publish",
"typecheck": "turbo run typecheck",
"check-package": "turbo check-package",
"knip": "knip",
"clean": "turbo clean",
"clean-full": "/bin/bash ./scripts/clean.sh"
},
"devDependencies": {
"@biomejs/biome": "^1.8.2",
"@changesets/cli": "^2.27.6",
"@biomejs/biome": "^1.8.3",
"@changesets/cli": "^2.27.7",
"@total-typescript/ts-reset": "^0.5.1",
"@types/bun": "^1.1.5",
"@types/bun": "^1.1.6",
"@types/node": "^20.14.9",
"bun": "^1.1.17",
"bun": "^1.1.18",
"knip": "^5.24.0",
"markdownlint-cli2": "^0.13.0",
"simple-git-hooks": "^2.11.1",
"turbo": "^2.0.5",
"typescript": "^5.5.2"
"turbo": "^2.0.6",
"typescript": "^5.5.3"
},
"overrides": {
"is-core-module": "npm:@nolyfill/is-core-module@^1"
},
"pnpm": {
"peerDependencyRules": {
"allowAny": ["svelte"]
}
},
"engines": {
"node": ">=20",
Expand All @@ -56,10 +66,5 @@
"url": "https://github.com/o-az"
}
],
"license": "MIT",
"pnpm": {
"peerDependencyRules": {
"allowAny": ["svelte"]
}
}
"license": "MIT"
}
13 changes: 8 additions & 5 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"scripts": {
"build": "tsup --config=tsup.config.ts",
"test": "vitest --run",
"test:ui": "vitest --ui",
"typecheck": "tsc --project tsconfig.json --noEmit",
"clean": "rm -rf dist",
"prebuild": "rm -rf dist",
Expand All @@ -36,17 +37,19 @@
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.15.3",
"@shikijs/transformers": "^1.9.1",
"@shikijs/transformers": "^1.10.1",
"@types/node": "^20.14.9",
"@vitest/ui": "^1.6.0",
"hast-util-to-html": "^9.0.1",
"mdast-util-to-hast": "^13.2.0",
"prettier": "^3.3.2",
"remark": "^15.0.1",
"shiki": "^1.9.1",
"shiki": "^1.10.1",
"ts-dedent": "^2.2.0",
"tsup": "^8.1.0",
"tsx": "^4.15.7",
"typescript": "^5.5.2",
"vite": "^5.3.1",
"tsx": "^4.16.2",
"typescript": "^5.5.3",
"vite": "^5.3.3",
"vitest": "^1.6.0"
},
"peerDependencies": {
Expand Down
Loading
Loading