Code Monkey home page Code Monkey logo

website-docs's Introduction

PingCAP Logo

website-docs

Click here to view.

Quick Start

  1. Clone this repo;

  2. Install dependent:

  • Run yarn;
  1. Download docs:
  • Run git submodule init;
  • Run git submodule update --depth 1 --remote;

After download

Run yarn start to develop:

yarn start

In order to debug algolia searches, you need to provide two additional environment variables:

  • GATSBY_ALGOLIA_APPLICATION_ID
  • GATSBY_ALGOLIA_API_KEY

Put them in .env.development to make them take effect. (Ref: https://www.gatsbyjs.com/docs/how-to/local-development/environment-variables/)

Workflow

Because of most of our text data stored in GitHub. It's needed to apply a GitHub API token in development when you are prompted for rate-limiting.

For more details, view https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting.

You must set the token as an env when you start some commands, defined as:

GITHUB_AUTHORIZATION_TOKEN=token

The rules we followed

For better collaboration and review, we have developed a few rules to help us develop better.

Before you contribute, you must read the following carefully.

JS

First, we use husky and lint-staged to make prettier format our code automatically before commit.

And also, because some of us use vscode to develop, we recommend to use sort-imports to format all imports. (This is optional, we will not force you to use)

Styles

Currently, we use sass to style each pages and components.

We hope you can follow this order (Don't care about their value) to organize all styles:

// Position first
position: relative;
top: 0;
bottom: 0;
left: 0;
right: 0;
// Then display
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
// Layout
width: 0;
height: 0;
margin: 0;
padding: 0;
// Colors
background: #fff;
color: #000;
// Outside
border: 0;
box-shadow: none;
// Finally, not often used values can be in any order

Be Compact

Don't include no used deps.

Don't let your code be too long-winded, there will be a lot of elegant writing.

Necessary Test

Every new features must have a unit test.

Shortcodes

Currently, you can use these shortcodes into docs:

Notifications

<Note>This is a note.</Note>

<Warning>This is a warning.</Warning>

<Tip>This is a tip.</Tip>

<Error>This is an error.</Error>

<Important>This is an important message.</Important>

Everything you need is just to write a JSX tag, put the text into it. Then we will use mdx to convert it to JS code.

Tab Panels

Use <SimpleTab> to create a tab panel. Do not put any h1 ~ h3 headings inside the tab panel.

<SimpleTab>
  <div label="LABEL_SHOW_ON_FIRST_TAB">
    This is the first content, which is markdown format. The content will show
    on the corresponding panel when users switch the tabs.
  </div>

  <div label="LABEL_SHOW_ON_SECOND_TAB">This is the second content.</div>
</SimpleTab>

Landing page for TiDB

Edit file _index.md in each doc repo to custom its landing page.

All columns have to be wrapped by tag <NavColumns></NavColumns>, each column has to be wrapped by tag <NavColumn></NavColumn>and column title has to be wrapped by tag <ColumnTitle></ColumnTitle>. For example:

<NavColumns>
  <NavColumn>
    <ColumnTitle>Column title</ColumnTitle>- [This is nav](/fileName.md) - [This
    is nav](/fileName.md) - [This is nav](/fileName.md) - [This is
    nav](/fileName.md)
  </NavColumn>

  <NavColumn>
    <ColumnTitle>Column title</ColumnTitle>- [This is nav](/fileName.md) - [This
    is nav](/fileName.md) - [This is nav](/fileName.md) - [This is
    nav](/fileName.md)
  </NavColumn>
</NavColumns>

License

MIT

website-docs's People

Contributors

austaras avatar cbid2 avatar dependabot[bot] avatar elewis787 avatar forksiva avatar g1eny0ung avatar hfxsd avatar icemap avatar kennytm avatar likidu avatar oreoxmt avatar qiancai avatar ran-huang avatar rpaik avatar shczhen avatar shhdgit avatar xuechunl avatar xuliwenwenwen avatar yikeke avatar yinixu9506 avatar you06 avatar yuiham avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

website-docs's Issues

Create a preview website for the refactor-migration-docs branch in pingcap/docs repo

Is your feature request related to a problem? Please describe.

The TiDB migration PMs are going to refactor the migration docs next week. A lot of doc changes will be made then.

Describe the solution you'd like

To avoid the impact on the delivery of the existing docs, a new branch named as refactor-migration-docs is created for the refactoring. During the document refactoring, the PMs need to send the preview website to other related colleagues for feedback and decide the next step, so it is important that we could provide a preview website for this branch.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Highlight the keywords in URL of docs search results

Background: When you search a keyword, sometimes you may ignore the exact result, because the keyword is not so friendly highlighted. For example: When you search general log from docs.pingcap.com, the second result is right the one. But users can miss it because the keyword is not highlighted, as shown below:

image

Requirement: Make the keywords stand out, more easily to see by highlighting words or other methods suggested by FE

Scope: Both English and Chinese documentation

@YiniXu9506 PTAL~ Thanks!

Add docs dev-guide online

  • add PDF generation and markdown lint

  • upload media to CDN

  • build docs dev-guide Chinese version and go live

  • update Algolia crawler

Add a version notice to TiDB Operator v1.0 docs

TiDB Operator v1.0 docs are no longer actively maintained, and users are recommended to use TiDB Operator v1.1 (stable) directly.
However, currently, because Google search results give more weight to v1.0 docs than v1.1, and we don't provide an obvious notice in v1.0 docs, some users are misguided to use v1.0.

So we propose adding a global version notice to v1.0 docs. For example:

Note:

You are viewing TiDB Operator v1.0 documentation, which is no longer actively maintained. For the latest stable version, click here.

Optimize git action workflow trigger name

image

PROBLEM
It is hard to tell each workflow is triggered by which pull request. It's inconvenient to debug when encountered problems.

TODO
Optimize the workflow name.

The cross-section links in tidb-stable-zh-manual.pdf are broken

Describe the bug
For https://download.pingcap.org/tidb-stable-zh-manual.pdf, whether you view it online or download it for a local check, you will find that the cross-sections links do not behave normally.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://download.pingcap.org/tidb-stable-zh-manual.pdf.
  2. For online view, after clicking a cross-section link, you are directed to the TOC page.
  3. Download the PDF for local view. After clicking a cross-section link, there is no response.

Expected behavior
In the document PDF, clicking a cross-section link should take you to the page of the target section.

Improve table output in PDF docs

Is your feature request related to a problem? Please describe.
The tables displayed in the PDF version of the TiDB documentation look unsatisfactory.
image
image

Describe the solution you'd like
Improve the table display in the PDF docs.

Change the language button

Currently, the language button at the foot of our documentation website only supports to jump to the home page of the other language.
We hope that by clicking this button, user can jump to the other language version of the current page . If the current page doesn't have a corresponding page in another language, we can prompt certain messages and then direct users to the home page.
image

Optimize the display of icons

对于已经展开的一级目录,能否图标有所区别?原因是:

  • 平时点击有个动态的效果
  • 从 database tools 点进来,这里正好是最后一行,看不出来这里已经展开,导致找不到位置
    image
    image

Add a mark on the right side of documentation page for two weeks

Is your feature request related to a problem? Please describe.

It is a feature request: In early November, the Documentation team plan to publish the “TiDB Documentation Satisfaction Survey" and invite users to fill out the form. To catch users' eyes, we would like to have a mark on the right side of the documentation pages.

Describe the solution you'd like

  1. Position
    1-1 Site: a mark (picture + words in one line, please refer to the attached photo) on the right side of
    all documents in following sites:

① PingCAP documentation page in Chinese
② PingCAP documentation page in English

1- 2 detailed positions of the mark on the sites are:

  • In all Chinese docs, it is in the middle of "反馈文档问题” and "本页导航“;
  • In all English docs, it is in the middle of "Request docs changes" and "What’s on this page".
  1. Request
    When users click the mark, they can see the survey on a new page. We will update the link later.

Describe alternatives you've considered

Additional context

sample pic of the request
.

Truncated text in tidb-stable-zh-manual.pdf

Describe the bug
For all tables in https://download.pingcap.org/tidb-stable-zh-manual.pdf, the alignment is center and the columns are too narrow to show the full text. As a reader, I could not even see the full text to understand the document.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://download.pingcap.org/tidb-stable-zh-manual.pdf.
  2. From the left TOC panel, click 部署标准集群 > 规划集群拓扑 > 混合部署拓扑.
  3. Check the table under 拓扑信息.
    image

Expected behavior

  • The tables in tidb-stable-zh-manual.pdf should be left-aligned.
  • The width of the table should fit the page.
  • If a cell contains long text, the cell should wrap the text instead of truncating it.

Make the docs feedback buttons always show on the page

Problem:
Currently, the two feedback buttons will automatically hide when readers scroll down.
This makes it difficult for readers to send feedback if they are in the middle of the page.
image
image

Request:
Please make the two buttons always show on the page.

TiDB docs website changes for

Is your feature request related to a problem? Please describe.
As a TiDB user, when I access the TiDB docs site, the default version is v5.0 (stable), which is confusing because v5.1 the latest stable version.

Describe the solution you'd like

  1. Set the v5.1 docs as the default entrance of the TiDB docs site using the stable URL.

  2. In the version list, update v5.0 (stable) to v5.0.

  3. For v2.1, v3.0, and v4.0, update the old version explanation banner to the following. In each banner, please replace v3.1 with the corresponding TiDB version.

Chinese:
重要:
你正在查看 TiDB 数据库的较旧版本 (TiDB v3.1) 的文档。如无特殊需求,建议使用 TiDB 数据库的最新稳定版本

English:

Important:
You are viewing the documentation of an older version of the TiDB database (TiDB v3.1). It is recommended that you use the latest stable version of the TiDB database.

  1. For the TiDB docs, except the Dev version, remove the "修改文本"/"Edit this page" link from the upper-right corner.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

ctrl+f search results refinement

Currently ctrl+f search results contain folded sidebar content.
It is suggested that adding display: none on folded content to tell browser not to search folded content.

index is strange in new doc page

Describe the bug

index is strange in new doc page (first picture
image

image

Desktop (please complete the following information):

  • OS: debian
  • Browser firefox
  • Version 91

Create a variable for the latest product version in TiDB user documents

Is your feature request related to a problem? Please describe.

Currently, when there is a new product version, the Docs team needs to update the current product version to the new version by searching the current version and replacing it with the new version.

However, not all product versions need to be updated to the new version, because some of them are just version-specific information, so the Docs team has to check each replacement (usually more than 100 instances) individually and update the version-specific information back to the old version, which is quite time-consuming and prone to errors.

Describe the solution you'd like

  1. Create a variable for the latest product version and add the variable definition to one Markdown file. For example, the variable name could be "tidb_latest_version", and the variable value could be "TiDB v5.0.4“。

  2. In each place where the product version needs to be pumped, update the product version (for example, TiDB v5.0.4) to the variable name (for example, $tidb_latest_version$).

  3. In the future, if there is a new product release, the Docs team can only update the variable value in that variable definition file.

Optimize element render inside simpleTab

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

The blockquote inside simpleTab is not rendered successfully. Also the style of tab can be more colorful.
image

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

请问如何实现本地开发环境热部署?

我本地把项目跑起来,更改项目中的代码,发现浏览器中并不能实时的进行渲染(手动刷新也是这样),这种实时渲染的效果该如何实现,不然开发起来每次重启很费时间

Create a Developers document entry in PingCAP English docs site

Is your feature request related to a problem? Please describe.
Please help create a document entry named "Developers" on the top navigation bar of the PingCAP English docs site as follows:
image

This entry is similar to that of TiDB 中文开发者指南 on the navigation bar of the PingCAP Chinese docs site.

Similar to 开发者指南, when we click on Developers, we are directed to a new document page named "App Dev Guide" like "TiDB 中文开发者指南", with an independent TOC in English. The visual style of the "App Dev Guide" document page is identical to that of "TiDB 中文开发者指南".

This document page parses and displays markdown documents located in the en directory of https://github.com/pingcap/dev-guide. Currently, a total of 7 documents are expected for display by October 20, 2021. The TOC of these documents is not yet decided.

Many thanks!

Deadline: October 20, 2021.

"Was this page helpful" area covers some section titles in the "What's on this page" pane

Describe the bug
For a document page with a lot of section titles, some titles in the "What's on this page" pane are covered by the "Was this page helpful" area.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://docs.pingcap.com/zh/tidb/stable/tidb-configuration-file.
  2. In the "What's on this page" pane, scroll down the section titles.
  3. See that some titles in the "What's on this page" pane are covered by the "Was this page helpful" area.

Expected behavior
The "Was this page helpful" area should not cover the section titles in the "What's on this page" pane.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: iOS
  • Browser: Chrome

Additional context
Add any other context about the problem here.

Sidebar rolls down again even if only switch tab.

Describe the bug

Sidebar rolls down again even if only switch tab.

To Reproduce

See the gif below.

Expected behavior

Sidebar should not roll down again at this case.

Screenshots

origin_img_v2_acc01b87-60b3-4811-bb3a-afbbf6b76f0g

Desktop (please complete the following information):

  • OS: Darwin MacBook-Pro 19.6.0 Darwin Kernel Version 19.6.0: Tue Jan 12 22:13:05 PST 2021; root:xnu-6153.141.16~1/RELEASE_X86_64 x86_64
  • Browser chrome
  • Version Version 91.0.4472.114 (Official Build) (x86_64)

Additional context
Add any other context about the problem here.

@gozssky

Remove trailing whitespace from md files

image-2020-08-28-17-49-07-829
screenshot-2

收到反馈:文档里的多余的 trailing space 导致官网代码块显示错乱。由于 gatsby-remard-mdx 的转化规则限制,在 code block 之前有 trailing whitespace 会导致 code 无法正常渲染。

解决方法:

  • 文档书写规范:可以开启编辑器的 trim trailing whitespace 的功能
    WeChatWorkScreenshot_6ca9a459-ae0e-453b-8a57-e5e74a9c8864

  • 前端构建:replaceStream remove trailing whitespace

DM-docs release-2.0 go live

dm-docs release-2.0 releases on 21st August.

  • Test dm-2.0

  • download dm-2.0 and update version list

  • Add dm-2.0 PDF generator and pr trigger website-docs git action.

  • Go live and hide entry temporary, run algolia

  • Go live and expose entry

Add TOOLS-TOC.md

“生态工具”支持单独的目录
即 即 docs-cn 里有一个类似 TOOLS-TOC.md 的文件,用于指定读取内容。

Move the language button

Currently the language button lives at footer. However, it is quite indirectly to user to find it.

Both Pulsar doc site and Flink doc site displays the language button at the nav bar so that we can always find the button at an obvious place. It would be more user-friendly if tidb docs align with them.

Add Baidu statistics

Describe the solution you'd like
A clear and concise description of what you want to happen.

A requirement from Chinese community -- they want to add baidu tongji to track docs website usage. The tracking code has been sent to @YiniXu9506.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.