Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,30 @@ const nextConfig = {
scrollRestoration: true,
reactCompiler: true,
},
async rewrites() {
return {
beforeFiles: [
// Explicit .md extension also serves markdown
{
source: '/:path*.md',
destination: '/api/md/:path*',
},
// Serve markdown when Accept header prefers text/markdown
// Useful for LLM agents - https://www.skeptrune.com/posts/use-the-accept-header-to-serve-markdown-instead-of-html-to-llms/
{
source: '/:path((?!llms\\.txt|api/md).*)',
has: [
{
type: 'header',
key: 'accept',
value: '(.*text/markdown.*)',
},
],
destination: '/api/md/:path*',
},
],
};
},
env: {},
webpack: (config, {dev, isServer, ...options}) => {
if (process.env.ANALYZE) {
Expand Down
8 changes: 7 additions & 1 deletion src/components/MDX/InlineCode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ function InlineCode({
return (
<code
// dir="ltr" // This is needed to prevent the code from inheriting the RTL direction of <html> in case of RTL languages to avoid like `()console.log` to be rendered as `console.log()`
dir={typeof props.children !== "string" ? "ltr" : ["[", "]"].includes(props.children) ? "rtl" : "ltr"}
dir={
typeof props.children !== 'string'
? 'ltr'
: ['[', ']'].includes(props.children)
? 'rtl'
: 'ltr'
}
className={cn(
'inline text-code text-secondary dark:text-secondary-dark px-1 rounded-md no-underline',
{
Expand Down
24 changes: 12 additions & 12 deletions src/content/learn/setup.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
---
title: Setup
title: الإعداد
---
<Intro>

React integrates with tools like editors, TypeScript, browser extensions, and compilers. This section will help you get your environment set up.
تتكامل React مع أدوات مثل المحررات، و TypeScript، وإضافات المتصفح، والمترجمات. سيساعدك هذا القسم على إعداد بيئة عملك.

</Intro>

## Editor Setup {/*editor-setup*/}
## إعداد المحرر {/*editor-setup*/}

See our [recommended editors](/learn/editor-setup) and learn how to set them up to work with React.
اطلع على [المحررات الموصى بها](/learn/editor-setup) وتعلم كيفية إعدادها للعمل مع React.

## Using TypeScript {/*using-typescript*/}
## استخدام TypeScript {/*using-typescript*/}

TypeScript is a popular way to add type definitions to JavaScript codebases. [Learn how to integrate TypeScript into your React projects](/learn/typescript).
تُعد TypeScript طريقة شائعة لإضافة تعريفات الأنواع إلى قواعد برمجيات JavaScript. [تعلم كيفية دمج TypeScript في مشاريع React الخاصة بك](/learn/typescript).

## React Developer Tools {/*react-developer-tools*/}
## أدوات مطوري React {/*react-developer-tools*/}

React Developer Tools is a browser extension that can inspect React components, edit props and state, and identify performance problems. Learn how to install it [here](learn/react-developer-tools).
أدوات مطوري React (React Developer Tools) هي إضافة للمتصفح يمكنها فحص مكونات React، وتعديل الخصائص (props) والحالة (state)، وتحديد مشاكل الأداء. تعلم كيفية تثبيتها [هنا](/learn/react-developer-tools).

## React Compiler {/*react-compiler*/}
## مترجم React {/*react-compiler*/}

React Compiler is a tool that automatically optimizes your React app. [Learn more](/learn/react-compiler).
مترجم React (React Compiler) هو أداة تقوم تلقائيًا بتحسين تطبيق React الخاص بك. [تعلم المزيد](/learn/react-compiler).

## Next steps {/*next-steps*/}
## الخطوات التالية {/*next-steps*/}

Head to the [Quick Start](/learn) guide for a tour of the most important React concepts you will encounter every day.
توجه إلى دليل [البداية السريعة](/learn) للقيام بجولة حول أهم مفاهيم React التي ستصادفها كل يوم.
13 changes: 5 additions & 8 deletions src/pages/[[...markdownPath]].js
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*/
Expand Down Expand Up @@ -154,7 +147,11 @@ export async function getStaticPaths() {
files
.flat()
// ignores `errors/*.md`, they will be handled by `pages/errors/[errorCode].tsx`
.filter((file) => file.endsWith('.md') && !file.startsWith('errors/'))
.filter(
(file) =>
file.endsWith('.md') &&
!file.replace(/\\/g, '/').startsWith('errors/')
)
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const MyDocument = () => {
document.documentElement.classList.add('uwu');
if (!logShown) {
console.log('uwu mode! turn off with ?uwu=0');
console.log('logo credit to @sawaratsuki1004 via https://github.com/SAWARATSUKI/ServiceLogos');
console.log('logo credit to @sawaratsuki1004 via https://github.com/SAWARATSUKI/KawaiiLogos');
logShown = true;
}
} else {
Expand Down
Loading