fix: correct anchors by using heading text only (#3167)
Addresses the issue mentioned in https://github.com/denoland/fresh/pull/3163#discussion_r2246708003. The issue was that the `raw` markdown was being used for e.g. `## My title`, thus the slug became `-my-title` instead of `my-title`. Slugs were working correctly for `codespan` in headers, e.g. ``## `someCode` ``. I decided to hard error if unexpected heading syntax is used over sluggifying unexpected content (can become super weird otherwise, e.g. `## <button ...>My heading</button>`). I can revert to fallbacking to `raw` if preferred, but perhaps with at least trimming leading `-` just in case.
This commit is contained in:
@@ -28,7 +28,7 @@ export function ServerCodePage(
|
||||
);
|
||||
}
|
||||
|
||||
export default function PageNotFound(props: PageProps) {
|
||||
export default function ErrorPage(props: PageProps) {
|
||||
const error = props.error;
|
||||
if (error instanceof HttpError) {
|
||||
if (error.status === 404) {
|
||||
|
||||
Reference in New Issue
Block a user