1
0
mirror of https://github.com/actix/actix-website synced 2024-11-23 16:31:08 +01:00

prettier js/html

This commit is contained in:
Rob Ede 2023-11-01 15:32:44 +00:00
parent 0d0e7f4433
commit ee701e0e23
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
10 changed files with 122 additions and 117 deletions

View File

@ -1,6 +1,6 @@
tabWidth: 2
overrides:
- files: ['*.md']
- files: ["*.md"]
options:
proseWrap: never
printWidth: 9999

View File

@ -1,3 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
presets: [require.resolve("@docusaurus/core/lib/babel/preset")],
};

View File

@ -1,42 +1,43 @@
const path = require('path');
const path = require("path");
module.exports = {
title: 'Actix',
tagline: 'Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust',
url: 'https://actix.rs',
baseUrl: '/',
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',
favicon: 'img/logo.png',
organizationName: 'actix', // Usually your GitHub org/user name.
projectName: 'actix-web', // Usually your repo name.
title: "Actix",
tagline:
"Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust",
url: "https://actix.rs",
baseUrl: "/",
onBrokenLinks: "throw",
onBrokenMarkdownLinks: "warn",
favicon: "img/logo.png",
organizationName: "actix", // Usually your GitHub org/user name.
projectName: "actix-web", // Usually your repo name.
themeConfig: {
navbar: {
title: 'Actix',
title: "Actix",
logo: {
alt: 'Actix Logo',
src: 'img/logo-icon.png',
alt: "Actix Logo",
src: "img/logo-icon.png",
width: 32,
height: 32,
},
items: [
{
to: 'docs',
activeBasePath: 'docs',
label: 'Documentation',
position: 'left',
to: "docs",
activeBasePath: "docs",
label: "Documentation",
position: "left",
},
{
to: 'community',
activeBasePath: 'community',
label: 'Community',
position: 'left',
to: "community",
activeBasePath: "community",
label: "Community",
position: "left",
},
{
to: 'code',
activeBasePath: 'code',
label: 'Code',
position: 'left',
to: "code",
activeBasePath: "code",
label: "Code",
position: "left",
},
],
},
@ -45,26 +46,25 @@ module.exports = {
},
prism: {
// dracula is closest to docs.rs, where keywords are highlighted
theme: require('prism-react-renderer/themes/dracula'),
additionalLanguages: ['rust', 'toml'],
defaultLanguage: 'rust'
theme: require("prism-react-renderer/themes/dracula"),
additionalLanguages: ["rust", "toml"],
defaultLanguage: "rust",
},
colorMode: {
respectPrefersColorScheme: true,
}
},
},
plugins: ["docusaurus-plugin-sass"],
presets: [
[
'@docusaurus/preset-classic',
"@docusaurus/preset-classic",
{
docs: {
sidebarPath: require.resolve('./sidebars.js'),
editUrl:
'https://github.com/actix/actix-website/edit/master/',
sidebarPath: require.resolve("./sidebars.js"),
editUrl: "https://github.com/actix/actix-website/edit/master/",
},
theme: {
customCss: require.resolve('./src/css/custom.css'),
customCss: require.resolve("./src/css/custom.css"),
},
},
],

View File

@ -1,7 +1,7 @@
<!doctype htmtl>
<!DOCTYPE htmtl>
<html>
<head>
<meta charset=utf-8>
<meta charset="utf-8" />
<title>Forms</title>
</head>
@ -14,17 +14,17 @@
let payload = {
timestamp: 12345,
kind: "this is a kind",
tags: ['tag1', 'tag2', 'tag3'],
}
tags: ["tag1", "tag2", "tag3"],
};
function submitJson() {
fetch('http://localhost:8080/event', {
method: 'POST',
fetch("http://localhost:8080/event", {
method: "POST",
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
Accept: "application/json",
"Content-Type": "application/json",
},
body: JSON.stringify(payload)
body: JSON.stringify(payload),
})
.then(function (res) {
return res.json();
@ -32,7 +32,7 @@
.then(function (data) {
let expected = {
...payload,
id: 1
id: 1,
};
console.log("expected: ", expected);
console.log("received: ", data);

View File

@ -1,44 +1,44 @@
module.exports = {
docs: {
Introduction: ['welcome', 'whatis'],
Introduction: ["welcome", "whatis"],
Basics: [
'getting-started',
'application',
'server',
'extractors',
'handlers',
"getting-started",
"application",
"server",
"extractors",
"handlers",
],
Advanced: [
'errors',
'url-dispatch',
'request',
'response',
'testing',
'middleware',
'static-files',
"errors",
"url-dispatch",
"request",
"response",
"testing",
"middleware",
"static-files",
],
Protocols: ['websockets', 'http2'],
Patterns: ['autoreload', 'databases', 'shuttle'],
Diagrams: ['http_server_init', 'conn_lifecycle'],
Protocols: ["websockets", "http2"],
Patterns: ["autoreload", "databases", "shuttle"],
Diagrams: ["http_server_init", "conn_lifecycle"],
Actix: [
'actix/sec-0-quick-start',
'actix/sec-1-getting-started',
'actix/sec-2-actor',
'actix/sec-3-address',
'actix/sec-4-context',
'actix/sec-5-arbiter',
'actix/sec-6-sync-arbiter',
"actix/sec-0-quick-start",
"actix/sec-1-getting-started",
"actix/sec-2-actor",
"actix/sec-3-address",
"actix/sec-4-context",
"actix/sec-5-arbiter",
"actix/sec-6-sync-arbiter",
],
'API Documentation': [
"API Documentation": [
{
type: 'link',
label: 'actix',
href: 'https://docs.rs/actix/latest/actix/',
type: "link",
label: "actix",
href: "https://docs.rs/actix/latest/actix/",
},
{
type: 'link',
label: 'actix-web',
href: 'https://docs.rs/actix-web/latest/actix_web/',
type: "link",
label: "actix-web",
href: "https://docs.rs/actix-web/latest/actix_web/",
},
],
},

View File

@ -1,21 +1,21 @@
import React, { useState, useEffect } from 'react';
import RenderCodeBlock from '@theme/CodeBlock';
import React, { useState, useEffect } from "react";
import RenderCodeBlock from "@theme/CodeBlock";
const CodeBlock = ({ example, file, section, language }) => {
const [code, setCode] = useState('');
const [code, setCode] = useState("");
useEffect(() => {
let isMounted = true;
const path =
file === 'manifest' ? 'Cargo.toml' : `src/${file ?? 'main.rs'}`;
file === "manifest" ? "Cargo.toml" : `src/${file ?? "main.rs"}`;
import(`!!raw-loader!@site/examples/${example}/${path}`)
.then((source) => {
source = source.default.match(
new RegExp(
`(?:\/\/|#) <${section}>\n([\\s\\S]*)(?:\/\/|#) <\/${section}>`
)
`(?:\/\/|#) <${section}>\n([\\s\\S]*)(?:\/\/|#) <\/${section}>`,
),
)[1];
if (isMounted) setCode(source);
@ -28,7 +28,7 @@ const CodeBlock = ({ example, file, section, language }) => {
}, []);
return (
<RenderCodeBlock className={`language-${language ?? 'rust'}`}>
<RenderCodeBlock className={`language-${language ?? "rust"}`}>
{code}
</RenderCodeBlock>
);

View File

@ -20,7 +20,7 @@
--ifm-menu-color-background-active: var(--ifm-color-emphasis-200);
}
html[data-theme='dark'] {
html[data-theme="dark"] {
--background-color-secondary: #0a191c;
--examples-odd-background-color: var(--ifm-hero-background-color);
--logo-filter: brightness(0) invert(1);
@ -47,7 +47,6 @@ html[data-theme='dark'] {
padding: 0 var(--ifm-pre-padding);
}
.navbar__logo {
filter: var(--logo-filter);
}

View File

@ -1,18 +1,18 @@
import clsx from 'clsx';
import React from 'react';
import Link from '@docusaurus/Link';
import Layout from '@theme/Layout';
import CodeBlock from '../components/code_block.js';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import useBaseUrl from '@docusaurus/useBaseUrl';
import styles from './styles.module.scss';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import clsx from "clsx";
import React from "react";
import Link from "@docusaurus/Link";
import Layout from "@theme/Layout";
import CodeBlock from "../components/code_block.js";
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
import useBaseUrl from "@docusaurus/useBaseUrl";
import styles from "./styles.module.scss";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import {
faShieldAlt,
faBatteryFull,
faPuzzlePiece,
faTachometerAlt,
} from '@fortawesome/free-solid-svg-icons';
} from "@fortawesome/free-solid-svg-icons";
const Home = () => {
const context = useDocusaurusContext();
@ -32,7 +32,7 @@ const Home = () => {
const highlights = [
{
icon: faShieldAlt,
title: 'Type Safe',
title: "Type Safe",
description: (
<>
Forget about stringly typed objects, from request to response,
@ -42,24 +42,31 @@ const highlights = [
},
{
icon: faBatteryFull,
title: 'Feature Rich',
title: "Feature Rich",
description: (
<>Actix provides a lot of features out of box. HTTP/2, logging, etc.</>
),
},
{
icon: faPuzzlePiece,
title: 'Extensible',
title: "Extensible",
description: (
<>Easily create your own libraries that any Actix application can use.</>
),
},
{
icon: faTachometerAlt,
title: 'Blazingly Fast',
title: "Blazingly Fast",
description: (
<>
Actix is blazingly fast. Don't take our word for it -- <a href='https://www.techempower.com/benchmarks/#section=data-r21&hw=ph&test=fortune' target='_blank' rel='noopener noreferrer'>see for yourself!</a>
Actix is blazingly fast. Don't take our word for it --{" "}
<a
href="https://www.techempower.com/benchmarks/#section=data-r21&hw=ph&test=fortune"
target="_blank"
rel="noopener noreferrer"
>
see for yourself!
</a>
</>
),
},
@ -70,7 +77,7 @@ const Hero = () => {
const { siteConfig } = context;
return (
<header id="hero" className={clsx('hero', styles.banner)}>
<header id="hero" className={clsx("hero", styles.banner)}>
<div className="container">
<img
src={useBaseUrl(`img/logo.png`)}
@ -79,14 +86,14 @@ const Hero = () => {
/>
<h1 className="hero__title">{siteConfig.title}</h1>
<p className={clsx('hero__subtitle', styles.subtitle)}>
<p className={clsx("hero__subtitle", styles.subtitle)}>
{siteConfig.tagline}
</p>
<div className={styles.buttons}>
<Link
className="button button--primary button--lg"
to={useBaseUrl('docs/')}
to={useBaseUrl("docs/")}
>
Get Started
</Link>
@ -106,7 +113,7 @@ const Highlights = () => {
<div className="row">
{highlights.map((highlight, idx) => (
<div
className={clsx('col col--6', styles.highlight)}
className={clsx("col col--6", styles.highlight)}
key={idx}
>
<div className="item">
@ -137,8 +144,9 @@ const Examples = () => {
<div className={styles.featureText}>
<h3 className={styles.featureTitle}>Hello World!</h3>
<p>
Getting started with Actix is easy. An Actix app comes with a URL routing system that lets you match on
URLs and invoke individual handlers.
Getting started with Actix is easy. An Actix app comes with a URL
routing system that lets you match on URLs and invoke individual
handlers.
</p>
</div>
<div className={styles.example__code}>
@ -169,11 +177,11 @@ const Examples = () => {
<div className={styles.featureText}>
<h3 className={styles.featureTitle}>Powerful Extractors</h3>
<p>
Actix comes with a powerful extractor system that extracts data from
the incoming HTTP request and passes it to your view functions. Not
only does this make for a convenient API but it also means that your
view functions can be synchronous code and still benefit from
asynchronous IO handling.
Actix comes with a powerful extractor system that extracts data
from the incoming HTTP request and passes it to your view
functions. Not only does this make for a convenient API but it
also means that your view functions can be synchronous code and
still benefit from asynchronous IO handling.
</p>
</div>
<div className={styles.example__code}>

View File

@ -3,9 +3,7 @@ module.exports = function (context, options) {
configureWebpack(config, isServer, utils) {
return {
module: {
rules: [
{ test: /\.rs$/, use: 'raw-loader' },
],
rules: [{ test: /\.rs$/, use: "raw-loader" }],
},
};
},

View File

@ -1,5 +1,5 @@
module.exports = {
rustVersion: '1.59',
actixWebMajorVersion: '4',
tokioMajorVersion: '1',
rustVersion: "1.59",
actixWebMajorVersion: "4",
tokioMajorVersion: "1",
};