Skip to content

Commit

Permalink
[i18n-ignore] fix(plugins): preserve permission anchor links (#2530)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog authored Aug 11, 2024
1 parent b8f25b0 commit f53709a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
5 changes: 4 additions & 1 deletion astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ export default defineConfig({
},
}),
starlightBlog({ authors }),
starlightLinksValidator({ errorOnRelativeLinks: false }),
starlightLinksValidator({
errorOnRelativeLinks: false,
exclude: ['/plugin/*/#default-permission', '/plugin/*/#permission-table'],
}),
],
title: 'Tauri',
description: 'The cross-platform app building toolkit',
Expand Down
10 changes: 9 additions & 1 deletion src/components/PluginPermissions.astro
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ const md = await createMarkdownProcessor();
const pageContent: string = await importMDX(plugin);
const content = await md.render(pageContent);
let code = content.code;
for (const heading of ['h1', 'h2', 'h3', 'h4']) {
code = code.replace(
new RegExp(`<${heading} id="([A-Za-z0-9\-]+)">([A-Za-z0-9\- ]+)</${heading}>`),
`<${heading} id="$1"><a href="#$1" class="heading-link">$2</a></${heading}>`
);
}
---

<Fragment set:html={content.code} />
<Fragment set:html={code} />
4 changes: 2 additions & 2 deletions src/content/docs/learn/Security/using-plugin-permissions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ permissions are used.

In the case of official maintained plugins you can find a
rendered description in the documentation
(eg. [fs default](/plugin/file-system/#permissions)).
(eg. [fs default](/plugin/file-system/#default-permission)).

In case you are figuring this out for a community plugin you
need to check out the source code of the plugin.
Expand Down Expand Up @@ -147,7 +147,7 @@ permissions are used.
The `fs` plugin has autogenerated permissions which will disable
or enable individual commands and allow or disable global scopes.

These can be found in the [documentation](/plugin/file-system/#permissions)
These can be found in the [documentation](/plugin/file-system/#permission-table)
or in the source code of the plugin (`fs/permissions/autogenerated`).

Let us assume we want to enable writing to a text file `test.txt`
Expand Down

0 comments on commit f53709a

Please sign in to comment.