Skip to content

Commit

Permalink
feat: update docs-page utils for anchor links (#607)
Browse files Browse the repository at this point in the history
* chore(docs-page): bump markdown-utils for anchor-links fix

* chore(docs-page): add changeset

* chore: bump to latest pre-release

* chore: bump to latest pre-release

* fix: use latest pre-release

* feat: bump to rm default remarkPlugins

* feat: upgrade to canary platform-markdown-utils

* fix: prop name

* fix(content): add jump link scroll offset

* chore(content): add changeset

* feat: thread rehypePlugins through docs-page

* feat: move style change to docs-page, fix changeset

* chore: nit in changeset

* tests: use anchorLinks plugin in tests

* chore: bump to stable remark-plugins

* fix: include scroll-margin-top for all jump links

* fix: target-lic scroll offset
  • Loading branch information
zchsh committed Jun 8, 2022
1 parent a250352 commit c4308f5
Show file tree
Hide file tree
Showing 9 changed files with 322 additions and 46 deletions.
43 changes: 43 additions & 0 deletions .changeset/four-readers-try.md
@@ -0,0 +1,43 @@
---
'@hashicorp/react-docs-page': major
---

BREAKING CHANGE: no longer provides default remark and rehype plugins.

Consumers should pass all `remarkPlugins` and `rehypePlugins` through loader options. To match previous behaviour, consumers should import our `@hashicorp/remark-plugins` as well as code highlighting plugins.

```ts
// Shared remark plugins
import {
includeMarkdown,
paragraphCustomAlerts,
typography,
anchorLinks,
} from '@hashicorp/remark-plugins'
// Code highlighting
import rehypePrism from '@mapbox/rehype-prism'
import rehypeSurfaceCodeNewlines from '@hashicorp/platform-code-highlighting/rehype-surface-code-newlines'
// To enable math features, add remarkMath & rehypeKatex
// import remarkMath from 'remark-math'
// import rehypeKatex from 'rehype-katex'

const remarkPlugins = [
[
includeMarkdown,
{
resolveMdx: true,
resolveFrom: path.join(process.cwd(), localPartialsDir),
},
],
paragraphCustomAlerts,
typography,
anchorLinks,
/* ... option to add more plugins here ... */
]

const rehypePlugins = [
[rehypePrism, { ignoreMissing: true }],
rehypeSurfaceCodeNewlines,
/* ... option to add more plugins here ... */
]
```
223 changes: 214 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 comment on commit c4308f5

@vercel
Copy link

@vercel vercel bot commented on c4308f5 Jun 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.