langchain/docs/docusaurus.config.js

258 lines
6.7 KiB
JavaScript
Raw Normal View History

/* eslint-disable global-require,import/no-extraneous-dependencies */
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion
// eslint-disable-next-line import/no-extraneous-dependencies
const { ProvidePlugin } = require("webpack");
const path = require("path");
2023-10-10 19:55:19 +00:00
const snippetsPath = path.resolve(__dirname, "snippets");
const baseLightCodeBlockTheme = require("prism-react-renderer/themes/vsLight");
const baseDarkCodeBlockTheme = require("prism-react-renderer/themes/vsDark");
/** @type {import('@docusaurus/types').Config} */
const config = {
title: "🦜️🔗 Langchain",
tagline: "LangChain Python Docs",
favicon: "img/favicon.ico",
customFields: {
mendableAnonKey: process.env.MENDABLE_ANON_KEY,
},
// Set the production url of your site here
url: "https://python.langchain.com",
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: "/",
2023-06-20 21:06:50 +00:00
onBrokenLinks: "warn",
onBrokenMarkdownLinks: "throw",
plugins: [
() => ({
name: "custom-webpack-config",
configureWebpack: () => ({
plugins: [
new ProvidePlugin({
process: require.resolve("process/browser"),
}),
],
resolve: {
fallback: {
path: false,
url: false,
},
alias: {
"@snippets": snippetsPath,
},
},
module: {
rules: [
{
test: /\.m?js/,
resolve: {
fullySpecified: false,
},
},
{
test: /\.py$/,
loader: "raw-loader",
resolve: {
fullySpecified: false,
},
},
{
test: /\.ipynb$/,
loader: "raw-loader",
resolve: {
2023-09-25 18:54:32 +00:00
fullySpecified: false,
},
},
],
},
}),
}),
],
presets: [
[
"classic",
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
sidebarPath: require.resolve("./sidebars.js"),
remarkPlugins: [
[require("@docusaurus/remark-plugin-npm2yarn"), { sync: true }],
],
async sidebarItemsGenerator({
defaultSidebarItemsGenerator,
...args
}) {
const sidebarItems = await defaultSidebarItemsGenerator(args);
sidebarItems.forEach((subItem) => {
// This allows breaking long sidebar labels into multiple lines
// by inserting a zero-width space after each slash.
if (
"label" in subItem &&
subItem.label &&
subItem.label.includes("/")
) {
// eslint-disable-next-line no-param-reassign
subItem.label = subItem.label.replace(/\//g, "/\u200B");
}
});
return sidebarItems;
},
},
pages: {
remarkPlugins: [require("@docusaurus/remark-plugin-npm2yarn")],
},
theme: {
customCss: require.resolve("./src/css/custom.css"),
},
}),
],
],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
docs: {
sidebar: {
hideable: true,
2023-10-11 02:56:21 +00:00
autoCollapseCategories: true,
},
},
colorMode: {
disableSwitch: false,
respectPrefersColorScheme: true,
},
prism: {
theme: {
...baseLightCodeBlockTheme,
plain: {
...baseLightCodeBlockTheme.plain,
backgroundColor: "#F5F5F5",
},
},
darkTheme: {
...baseDarkCodeBlockTheme,
plain: {
...baseDarkCodeBlockTheme.plain,
backgroundColor: "#222222",
},
},
},
image: "img/parrot-chainlink-icon.png",
navbar: {
title: "🦜️🔗 LangChain",
items: [
2023-07-21 20:52:03 +00:00
{
to: "/docs/get_started/introduction",
label: "Docs",
position: "left",
},
{
2023-09-25 18:54:32 +00:00
type: "docSidebar",
position: "left",
sidebarId: "use_cases",
label: "Use cases",
2023-07-21 20:52:03 +00:00
},
{
2023-09-25 18:54:32 +00:00
type: "docSidebar",
position: "left",
sidebarId: "integrations",
label: "Integrations",
2023-07-21 20:52:03 +00:00
},
{
2023-09-28 19:44:52 +00:00
to: "https://api.python.langchain.com",
2023-07-21 20:52:03 +00:00
label: "API",
position: "left",
},
2023-09-28 19:44:52 +00:00
{
to: "/docs/community",
label: "Community",
position: "left",
},
{
to: "https://chat.langchain.com",
label: "Chat our docs",
position: "right",
},
2023-07-18 14:39:26 +00:00
{
to: "https://smith.langchain.com",
label: "LangSmith",
position: "right",
},
{
to: "https://js.langchain.com/docs",
label: "JS/TS Docs",
position: "right",
},
// Please keep GitHub link to the right for consistency.
{
href: "https://github.com/langchain-ai/langchain",
2023-09-25 18:54:32 +00:00
position: "right",
className: "header-github-link",
"aria-label": "GitHub repository",
},
],
},
footer: {
style: "light",
links: [
{
title: "Community",
items: [
{
label: "Discord",
href: "https://discord.gg/cU2adEyC7w",
},
{
label: "Twitter",
href: "https://twitter.com/LangChainAI",
},
],
},
{
title: "GitHub",
items: [
{
label: "Python",
href: "https://github.com/langchain-ai/langchain",
},
{
label: "JS/TS",
href: "https://github.com/langchain-ai/langchainjs",
},
],
},
{
title: "More",
items: [
{
label: "Homepage",
href: "https://langchain.com",
},
{
label: "Blog",
href: "https://blog.langchain.dev",
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} LangChain, Inc.`,
},
}),
2023-09-25 18:54:32 +00:00
scripts: [
"/js/google_analytics.js",
{
src: "https://www.googletagmanager.com/gtag/js?id=G-9B66JQQH2F",
async: true,
},
],
};
module.exports = config;