Skip to content

Commit

Permalink
Merge pull request #155 from appwrite/fix-specs-links
Browse files Browse the repository at this point in the history
fix: specs links
  • Loading branch information
TorstenDittmann authored Oct 13, 2023
2 parents 8fe67b8 + b18632d commit af87129
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 35 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"dependencies": {
"@appwrite.io/pink": "0.1.0-next.9",
"@appwrite.io/pink-icons": "0.1.0-next.9",
"@appwrite.io/repo": "github:appwrite/appwrite",
"@appwrite.io/repo": "github:appwrite/appwrite#main",
"@splinetool/viewer": "0.9.455",
"compression": "^1.7.4",
"express": "^4.18.2",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

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

57 changes: 30 additions & 27 deletions src/lib/utils/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,38 @@ import MarkdownIt from 'markdown-it';

const md = new MarkdownIt('commonmark');
export function parse(content: string): string {
const tokens = md.parse(content, null);
const tokens = md.parse(content, null);

return md.renderer.render(
transform_tokens(tokens),
{
highlight: null
},
null
);
return md.renderer.render(
transform_tokens(tokens),
{
highlight: null
},
null
);
}

function transform_tokens(tokens: ReturnType<typeof md.parse>): ReturnType<typeof md.parse> {
return tokens.map((token) => {
if (token.children) {
token.children = transform_tokens(token.children);
}
switch (token.type) {
case 'paragraph_open':
token.attrPush(['class', 'aw-paragraph']);
break;
case 'link_open':
if (token.attrGet('href')?.startsWith('http')) {
token.attrPush(['target', '_blank']);
}
// disable links for now
token.attrSet('href', '#');
token.attrPush(['class', 'aw-link']);
break;
}
return token;
});
return tokens.map((token) => {
if (token.children) {
token.children = transform_tokens(token.children);
}
switch (token.type) {
case 'paragraph_open':
token.attrPush(['class', 'aw-paragraph']);
break;
case 'link_open': {
const href = token.attrGet('href');
if (href?.startsWith('http')) {
if (!href.startsWith('https://appwrite.io')) {
token.attrPush(['rel', 'noopener noreferrer']);
token.attrPush(['target', '_blank']);
}
}
token.attrPush(['class', 'aw-link']);
break;
}
}
return token;
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
<section class="aw-article-content-grid-6-4">
<div class="aw-article-content-grid-6-4-column-1 u-flex-vertical u-gap-32">
<header class="aw-article-content-header">
<Heading id={method.id} level={2} inReferences>{method.title}</Heading>
<Heading id={method.id} level={1} inReferences>{method.title}</Heading>
</header>
<p class="aw-sub-body-400">
{@html parse(method.description)}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
The Account service allows you to authenticate and manage a user account. You can use the account service to update user information, retrieve the user sessions across different devices, and fetch the user security logs with his or her recent activity.

Register new user accounts with the [Create Account](#create), [Create Magic URL session](#createMagicURLSession), or [Create Phone session](#createPhoneSession) endpoint. You can authenticate the user account by using multiple sign-in methods available. Once the user is authenticated, a new session object will be created to allow the user to access his or her private data and settings.
Register new user accounts with the [Create Account](/docs/references/cloud/client-web/account#create), [Create Magic URL session](/docs/references/cloud/client-web/account#createMagicURLSession), or [Create Phone session](/docs/references/cloud/client-web/account#createPhoneSession) endpoint. You can authenticate the user account by using multiple sign-in methods available. Once the user is authenticated, a new session object will be created to allow the user to access his or her private data and settings.

This service also exposes an endpoint to save and read the [user preferences](#updatePrefs) as a key-value object. This feature is handy if you want to allow extra customization in your app. Common usage for this feature may include saving the user's preferred locale, timezone, or custom app theme.
This service also exposes an endpoint to save and read the [user preferences](/docs/references/cloud/client-web/account#updatePrefs) as a key-value object. This feature is handy if you want to allow extra customization in your app. Common usage for this feature may include saving the user's preferred locale, timezone, or custom app theme.

0 comments on commit af87129

Please sign in to comment.