Skip to content

Commit

Permalink
Merge pull request #11 from sg-developer-portal/Andyka/fix-folder-lin…
Browse files Browse the repository at this point in the history
…k-bugs

Andyka/fix folder link bugs
  • Loading branch information
lx0f committed Mar 21, 2024
2 parents e5028ba + 481df79 commit 635c2c6
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 27 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ Copy the css link into your html file.
<!-- index.html -->
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@lx0f/docsify-sidebar-collapse@2.0.7/dist/index.css"
href="https://cdn.jsdelivr.net/npm/@lx0f/docsify-sidebar-collapse@2.0.24/dist/index.css"
/>
```

Copy the script tag into your html file.

```html
<script src="https://cdn.jsdelivr.net/npm/@lx0f/docsify-sidebar-collapse@2.0.7/dist/index.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@lx0f/docsify-sidebar-collapse@2.0.24/dist/index.js"></script>
```

Setup sidebar configuration in your docsify config.
Expand All @@ -28,10 +28,13 @@ window.$docsify = {
nameLink: "/docs/slug",
};
```

## Publishing

### GitHub

If semantic release fails during GitHub Actions, please ensure that the **GH_TOKEN** provided is valid and contains the correct permissions. Members of the repo can consider updating the token under secrets of the project if the existing token is lost. The Perosnal Access Token can be created under member's personal setting and a **repo** scope is needed for the release to run.

### NPM
If publishing fails during GitHub Actions, please ensure that the **NPM_TOKEN** provided is valid and contains the correct permissions. Member of the repo (on GitHub and NPM) can consider updating the secrets of the project if the existing token is lost.

If publishing fails during GitHub Actions, please ensure that the **NPM_TOKEN** provided is valid and contains the correct permissions. Member of the repo (on GitHub and NPM) can consider updating the secrets of the project if the existing token is lost.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@developerportalsg/docsify-sidebar-collapse",
"version": "2.0.23",
"version": "2.0.24",
"type": "module",
"description": "A docsify plugin for a collapsible sidebar!",
"author": "Luth Andyka <luthandyka.business@gmail.com>",
Expand Down Expand Up @@ -55,4 +55,4 @@
"path": "./node_modules/cz-conventional-changelog"
}
}
}
}
4 changes: 2 additions & 2 deletions src/assets/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ $active-node-color: #0076d6;
}

.node.has-active > .head > .text {
a > span, span {
strong, span {
color: $active-node-color;
}
}

.node.is-active > .head {
background-color: $active-node-background-color;
.text {
a > span, span {
strong, span {
color: $active-node-color;
}
}
Expand Down
11 changes: 2 additions & 9 deletions src/components/em.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
import { Tokens } from "marked";
import { ComponentProps, JSX } from "preact";
import Token from "./token";
import { ComponentProps } from "preact";

type EmProps = {
token: Tokens.Em;
} & ComponentProps<"em">;

export default function Em({ token, ...props }: EmProps) {
let el: JSX.Element[] | undefined = undefined;
if (token.tokens) {
el = token.tokens.map((t, idx) => (
<Token token={t} key={`token-${token.type}-${token.text}-${idx}`} />
));
}
return <em {...props}>{el || token.text}</em>;
return <em {...props}>{token.text}</em>;
}
7 changes: 5 additions & 2 deletions src/components/root-list-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ export default function RootListItem({

const linkToken = getLinkToken(textToken);

const _ha = (url: URL, token: Tokens.List) => getActiveLinkToken(token, url);
const _ha = (url: URL, token: Tokens.List) =>
getActiveLinkToken(token, url) !== undefined;
const _ia = (url: URL, token?: Tokens.Link) =>
(token && isActiveLinkToken(token, url)) || false;

Expand All @@ -63,7 +64,9 @@ export default function RootListItem({
const ia = _ia(url, linkToken);
setHasActive(ha);
setIsActive(ia);
setShow(ha || ia);
if (!(ha || ia)) {
setShow(ha || ia);
}
});

return (
Expand Down
11 changes: 2 additions & 9 deletions src/components/strong.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
import { Tokens } from "marked";
import { ComponentProps, JSX } from "preact";
import Token from "./token";
import { ComponentProps } from "preact";

type StrongProps = {
token: Tokens.Strong;
} & ComponentProps<"strong">;

export default function Strong({ token, ...props }: StrongProps) {
let el: JSX.Element[] | undefined = undefined;
if (token.tokens) {
el = token.tokens.map((t, idx) => (
<Token token={t} key={`token-${token.type}-${token.text}-${idx}`} />
));
}
return <strong {...props}>{el || token.text}</strong>;
return <strong {...props}>{token.text}</strong>;
}

0 comments on commit 635c2c6

Please sign in to comment.