Skip to content

Feat: Add book index page #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 7, 2023
Merged
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
.docusaurus
debug
build
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node-version=18.0.0
registry=https://registry.npmjs.org
3 changes: 3 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
16 changes: 16 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: ''
---

<div style={{
display: 'flex',
justifyContent: 'center'
}}>
<img
src="./img/book_cover.png"
style={{
height: '75vh',
margin: '0 auto',
}}
/>
</div>
114 changes: 114 additions & 0 deletions docusaurus.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'JavaScript 工程师的 Python 指南',
tagline: 'Python, JavaScript, 编程, 经验, 教程, 开源, 免费, 电子书, 下载, PDF, 示例',
url: 'https://luckrnx09.github.io',
baseUrl: '/books/python-guide-for-javascript-engineers/',
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'throw',
favicon: 'img/favicon.ico',
projectName: 'python-guide-for-javascript-engineers',
presets: [
[
'classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
sidebarPath: require.resolve('./sidebars.js'),
sidebarCollapsed: false,
editUrl: 'https://github.com/luckrnx09/python-guide-for-javascript-engineers/edit/main/',
routeBasePath: '/',
path: './docs',
editLocalizedFiles: false,
},
blog: false,
theme: {
customCss: require.resolve('./src/css/custom.css'),
},
sitemap: {
changefreq: 'weekly',
priority: 0.5,
}
}),
],
],

themeConfig: (
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
{
docs: {
sidebar: {
hideable: true,
},
},
colorMode: {
defaultMode: 'light',
disableSwitch: false,
respectPrefersColorScheme: true,
},
navbar: {
hideOnScroll: true,
title: 'JavaScript 工程师的 Python 指南',
items: [
{
label:'Github',
position: 'right',
href:'https://github.com/luckrnx09/python-guide-for-javascript-engineers'
},
],
logo: {
alt: 'JavaScript 工程师的 Python 指南',
href: '/',
src: './img/favicon.ico'
},
},
metadata: [
{ name: 'keywords', content: 'Python, JavaScript, 编程, 经验, 教程, 开源, 免费, 电子书, 下载, PDF, 示例' },
{ name: 'description', content: '《JavaScript 工程师的 Python 指南》,是一本的开源电子书,囊括从 Python 环境安装到项目开发所需要的各种知识。本书通过案例对比 JavaScript 和 Python 的异同,帮助 JavaScript 工程师快速掌握 Python 语言。' },
{ name: 'author', content: 'luckrnx09' },
],
}
),
plugins: [
function (context, options) {
return {
name: 'baidu-plugin',
injectHtmlTags({ content }) {
return {
postBodyTags: [`
<script type="text/javascript">
(function(c,l,a,r,i,t,y){
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
})(window, document, "clarity", "script", "k0fttuea53");
</script>
`],
};
},
};
},
[
require.resolve("@easyops-cn/docusaurus-search-local"),
{
hashed: true,
language: ["zh"],
docsRouteBasePath: "/",
highlightSearchTermsOnTargetPage: true,
},
],
],
stylesheets: [],
i18n: {
defaultLocale: 'zh-cn',
locales: ['zh-cn'],
localeConfigs: {
'zh-cn': {
label: '中文',
direction: 'ltr',
},
},
},
};

module.exports = config;
3 changes: 3 additions & 0 deletions giscus.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"defaultCommentOrder": "newest"
}
50 changes: 50 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"name": "python-guide-for-web-engineers",
"version": "0.0.0",
"private": true,
"scripts": {
"docusaurus": "docusaurus",
"start": "docusaurus start",
"build": "docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
"clear": "docusaurus clear",
"serve": "docusaurus serve",
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
"typecheck": "tsc"
},
"dependencies": {
"@docusaurus/core": "3.0.0",
"@docusaurus/plugin-content-docs": "^3.0.1",
"@docusaurus/preset-classic": "3.0.0",
"@easyops-cn/docusaurus-search-local": "^0.38.1",
"@giscus/react": "^2.3.0",
"@mdx-js/react": "^3.0.0",
"clsx": "^1.2.1",
"prism-react-renderer": "^2.1.0",
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "3.0.0",
"@docusaurus/tsconfig": "3.0.0",
"@docusaurus/types": "3.0.0",
"typescript": "~5.2.2"
},
"browserslist": {
"production": [
">0.5%",
"not dead",
"not op_mini all"
],
"development": [
"last 3 chrome version",
"last 3 firefox version",
"last 5 safari version"
]
},
"engines": {
"node": ">=18.0"
}
}
Loading