Skip to content

Commit

Permalink
improve code blocks highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
1330Petrel committed Feb 24, 2025
1 parent b89be53 commit b509678
Show file tree
Hide file tree
Showing 5 changed files with 186 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docs/learning_resources/os/commands.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 基本终端命令

[终端](../os/terminal.md)中工作是后端开发人员的常见做法,而且有许多命令和实用程序可以帮助你更有效地完成任务。
在终端中工作是后端开发人员的常见做法,而且有许多命令和实用程序可以帮助你更有效地完成任务。

学习这些命令的最佳方式是在你自己的机器或环境中实践它们。特别是,这些命令与市面上最普遍的 Linux 命令/实用程序有关。

Expand Down
15 changes: 7 additions & 8 deletions docusaurus.config.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import remarkMath from 'remark-math';
import rehypeKatex from 'rehype-katex';

import { themes as prismThemes } from 'prism-react-renderer';
import PrismLight from './src/utils/prismLight';
import PrismDark from './src/utils/prismDark';

import type { Config } from '@docusaurus/types';

import type * as Preset from '@docusaurus/preset-classic';
import type { Options as DocsOptions } from '@docusaurus/plugin-content-docs';
import type { Options as BlogOptions } from '@docusaurus/plugin-content-blog';

const config: Config = {
export default {
title: '清华大学自动化系学生科协',
tagline: 'ASTAers are cool',
favicon: 'img/favicon.ico',
Expand Down Expand Up @@ -61,7 +62,7 @@ const config: Config = {
rehypePlugins: [rehypeKatex],
} satisfies DocsOptions,
blog: {
// editUrl: 'https://github.com/thuasta/website/tree/main/',
// editUrl: 'https://github.com/thuasta/thuasta.org/tree/main/',
showReadingTime: true,
feedOptions: {
type: 'all',
Expand Down Expand Up @@ -95,8 +96,8 @@ const config: Config = {
respectPrefersColorScheme: true,
},
prism: {
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
theme: PrismLight,
darkTheme: PrismDark,
additionalLanguages: ['bash', 'cmake', 'powershell'],
},
docs: {
Expand Down Expand Up @@ -167,6 +168,4 @@ const config: Config = {
copyright: `Copyright © ${new Date().getFullYear()} ASTA. Built with Docusaurus.`,
},
} satisfies Preset.ThemeConfig,
} satisfies Config;

export default config;
} satisfies Config;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Basic Terminal Commands

Working within the [terminal](../os/terminal.md) is common practice for any Backend Developer and there are many commands and utilities that can help you achieve your tasks more efficiently.
Working within the terminal is common practice for any Backend Developer and there are many commands and utilities that can help you achieve your tasks more efficiently.

The best way to learn these commands is to practice them in your own machine/environment. Specifically, these are related to Linux commands/utilities which are the most prevalent in the market.

Expand Down
78 changes: 78 additions & 0 deletions src/utils/prismDark.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/**
* This file is from https://github.com/facebook/docusaurus/blob/main/website/src/utils/prismDark.ts
*/

import { themes, type PrismTheme } from 'prism-react-renderer';

const baseTheme = themes.dracula;

export default {
plain: {
color: '#D4D4D4',
backgroundColor: '#212121',
},
styles: [
...baseTheme.styles,
{
types: ['title'],
style: {
color: '#569CD6',
fontWeight: 'bold',
},
},
{
types: ['property', 'parameter'],
style: {
color: '#9CDCFE',
},
},
{
types: ['script'],
style: {
color: '#D4D4D4',
},
},
{
types: ['boolean', 'arrow', 'atrule', 'tag'],
style: {
color: '#569CD6',
},
},
{
types: ['number', 'color', 'unit'],
style: {
color: '#B5CEA8',
},
},
{
types: ['font-matter'],
style: {
color: '#CE9178',
},
},
{
types: ['keyword', 'rule'],
style: {
color: '#C586C0',
},
},
{
types: ['regex'],
style: {
color: '#D16969',
},
},
{
types: ['maybe-class-name'],
style: {
color: '#4EC9B0',
},
},
{
types: ['constant'],
style: {
color: '#4FC1FF',
},
},
],
} satisfies PrismTheme;
99 changes: 99 additions & 0 deletions src/utils/prismLight.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/**
* This file is from https://github.com/facebook/docusaurus/blob/main/website/src/utils/prismLight.ts
*/

import { themes, type PrismTheme } from 'prism-react-renderer';

const baseTheme = themes.github;

export default {
...baseTheme,
styles: [
...baseTheme.styles,
{
types: ['title'],
style: {
color: '#0550AE',
fontWeight: 'bold',
},
},
{
types: ['parameter'],
style: {
color: '#953800',
},
},
{
types: ['boolean', 'rule', 'color', 'number', 'constant', 'property'],
style: {
color: '#005CC5',
},
},
{
types: [/*'atrule', */'tag'],
style: {
color: '#22863A',
},
},
{
types: ['script'],
style: {
color: '#24292E',
},
},
{
types: ['operator', 'unit', 'rule'],
style: {
color: '#D73A49',
},
},
{
types: ['font-matter', 'string', 'attr-value'],
style: {
color: '#C6105F',
},
},
{
types: ['class-name'],
style: {
color: '#116329',
},
},
{
types: ['attr-name'],
style: {
color: '#0550AE',
},
},
{
types: ['keyword'],
style: {
color: '#CF222E',
},
},
{
types: ['function'],
style: {
color: '#8250DF',
},
},
{
types: ['selector'],
style: {
color: '#6F42C1',
},
},
{
types: ['variable'],
style: {
color: '#E36209',
},
},
{
types: ['comment'],
style: {
color: '#6B6B6B',
},
},
],
} satisfies PrismTheme;

0 comments on commit b509678

Please sign in to comment.