lint: добавление линтера #5
@@ -1,9 +1,10 @@
|
||||
import fs from 'fs';
|
||||
import yaml from 'js-yaml';
|
||||
import { themes as prismThemes } from 'prism-react-renderer';
|
||||
import type { Config } from '@docusaurus/types';
|
||||
|
||||
import type * as Preset from '@docusaurus/preset-classic';
|
||||
import type { NavbarItem } from '@docusaurus/theme-common';
|
||||
import type { Config } from '@docusaurus/types';
|
||||
import yaml from 'js-yaml';
|
||||
import { themes as prismThemes } from 'prism-react-renderer';
|
||||
|
||||
interface DocsConfig {
|
||||
title: string;
|
||||
@@ -19,7 +20,7 @@ const url = process.env.DOCUSERVIX_URL;
|
||||
|
||||
const { org, repo } = docsConfig.project;
|
||||
|
||||
const { docs: docsDir = 'docs', blog: blogDir } = docsConfig.dirs || {};
|
||||
const { docs: _docsDir = 'docs', blog: blogDir } = docsConfig.dirs || {};
|
||||
|
||||
const giteaUrl = 'https://git.jt4d.ru';
|
||||
const onBrokenLinks =
|
||||
@@ -116,7 +117,8 @@ const config: Config = {
|
||||
},
|
||||
footer: {
|
||||
style: 'dark',
|
||||
copyright: `Проект хостится на JT4D.ru, документация собрана с использованием Docuservix и Docusaurus.`,
|
||||
copyright:
|
||||
'Проект хостится на JT4D.ru, документация собрана с использованием Docuservix и Docusaurus.',
|
||||
},
|
||||
prism: {
|
||||
theme: prismThemes.github,
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/* eslint-disable no-console -- logs required */
|
||||
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
@@ -10,16 +12,25 @@ pinIndexToTop();
|
||||
*/
|
||||
function pinIndexToTop() {
|
||||
const indexPath = path.join(docsDir, 'index.md');
|
||||
if (!fs.existsSync(indexPath)) return;
|
||||
|
||||
if (!fs.existsSync(indexPath)) {
|
||||
return;
|
||||
}
|
||||
|
||||
let content = fs.readFileSync(indexPath, 'utf8');
|
||||
|
||||
if (content.startsWith('---\n')) {
|
||||
const endIdx = content.indexOf('\n---\n', 4);
|
||||
if (endIdx === -1) return;
|
||||
|
||||
if (endIdx === -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
const frontMatter = content.slice(4, endIdx);
|
||||
if (/^sidebar_position\s*:/m.test(frontMatter)) return;
|
||||
|
||||
if (/^sidebar_position\s*:/m.test(frontMatter)) {
|
||||
return;
|
||||
}
|
||||
|
||||
content =
|
||||
'---\nsidebar_position: 0\n' + frontMatter + '\n---\n' + content.slice(endIdx + 5);
|
||||
|
||||
+5
-3
@@ -1,14 +1,15 @@
|
||||
import type { ReactNode } from 'react';
|
||||
import clsx from 'clsx';
|
||||
import Link from '@docusaurus/Link';
|
||||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
||||
import Layout from '@theme/Layout';
|
||||
import Heading from '@theme/Heading';
|
||||
import Layout from '@theme/Layout';
|
||||
import clsx from 'clsx';
|
||||
import type { ReactNode } from 'react';
|
||||
|
||||
import styles from './index.module.css';
|
||||
|
||||
function HomepageHeader() {
|
||||
const { siteConfig } = useDocusaurusContext();
|
||||
|
||||
return (
|
||||
<header className={clsx('hero hero--primary', styles.heroBanner)}>
|
||||
<div className="container">
|
||||
@@ -34,6 +35,7 @@ function HomepageHeader() {
|
||||
|
||||
export default function Home(): ReactNode {
|
||||
const { siteConfig } = useDocusaurusContext();
|
||||
|
||||
return (
|
||||
<Layout
|
||||
title={`Hello from ${siteConfig.title}`}
|
||||
|
||||
Reference in New Issue
Block a user