Skip to content

Commit

Permalink
feature(docs): fix broken links when embedded in promise/signal
Browse files Browse the repository at this point in the history
  • Loading branch information
4x8Matrix committed Jul 4, 2024
1 parent 590184b commit 20a35dc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/components/LuaProperty.astro
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,19 @@ type Props = {
};
const { name, type } = Astro.props;
var realType = type;
if (type.includes("<")) {
const embeddedType = type.match(/<(.*?)>/);
realType = embeddedType![1];
}
---

<div class="declaration">
<span class="declaration arg">{name}</span>
<span class="declaration">&nbsp;:: </span>
<span class="declaration type"><LuaType type={type} url={getTypeDocs(type)} /></span>
<span class="declaration type"><LuaType type={type} url={getTypeDocs(realType)} /></span>
</div>
1 change: 1 addition & 0 deletions src/components/utils/lua.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export const getCustomTypeDocs = (type: string) => {

export const getTypeDocs = (type: string) => {
const normalizedType = removeTypeModifiers(type);

return normalizedType in luaTypeDocs
? getLuaDocs(normalizedType)
: getCustomTypeDocs(type);
Expand Down

0 comments on commit 20a35dc

Please sign in to comment.