pingcap / website-docs

The next generation of PingCAP Docs. Powered by Gatsby ⚛️.
https://docs.pingcap.com/
MIT License
22 stars 33 forks source link

feat: version-compare-component #445

Open Icemap opened 8 months ago

Icemap commented 8 months ago

This is a feature that can filter variables for the System Variables document by the version of TiDB.

Created Components

Three components are created:

<VersionVarsFilter/>
<VersionVars/>
<MDLink/>

Usage

VersionVarsFilter and VersionVars are a pair of components, that can be used like:

<VersionVarsFilter versions="v7.4.0,v7.3.0,v7.2.0,v7.1.1,v7.1.0,v7.0.0,v6.6.0,v6.5.5,v6.5.4,v6.5.3,v6.5.2,v6.5.1,v6.5.0,v6.4.0,v6.3.0,v6.2.0,v6.1.7,v6.1.6,v6.1.5,v6.1.4,v6.1.3,v6.1.2,v6.1.1,v6.1.0,v6.0.0,v5.4.3,v5.4.2,v5.4.1,v5.4.0,v5.3.4,v5.3.3,v5.3.2,v5.3.1,v5.3.0,v5.2.4,v5.2.3,v5.2.2,v5.2.1,v5.2.0,v5.1.5,v5.1.4,v5.1.3,v5.1.2,v5.1.1,v5.1.0,v5.0.6,v5.0.5,v5.0.4,v5.0.3,v5.0.2,v5.0.1,v4.0.16,v4.0.15,v4.0.14,v4.0.13,v4.0.12,v4.0.11,v4.0.10,v4.0.9,v4.0.8,v4.0.7,v4.0.6,v4.0.5,v4.0.4,v4.0.3,v4.0.2,v4.0.1,v3.1.2,v3.1.1,v3.0.20,v3.0.19,v3.0.18,v3.0.17,v3.0.16,v3.0.15,v3.0.14,v3.0.13,v3.0.12,v3.0.11,v3.0.10,v3.0.9,v3.0.8,v3.0.7,v3.0.6,v3.0.5,v3.0.4,v3.0.3,v3.0.2,v3.0.1,v2.1.19,v2.1.18,v2.1.17,v2.1.16,v2.1.15,v2.1.14,v2.1.13,v2.1.12,v2.1.11,v2.1.10,v2.1.9,v2.1.8,v2.1.7,v2.1.6,v2.1.5,v2.1.4,v2.1.3,v2.1.2,v2.1.1,v2.0.11,v2.0.10,v2.0.9,v2.0.8,v2.0.7,v2.0.6,v2.0.5,v2.0.4,v2.0.3,v2.0.2,v2.0.1,v1.0.8,v1.0.7,v1.0.6,v1.0.5,v1.0.4,v1.0.3,v1.0.2,v1.0.1">

<VersionVars
    name="allow_auto_random_explicit_insert"
    introducedVersion="v4.0.3"
    scope="BOTH"
    persists="true"
    applyHint="false"
    type="Boolean"
    defaultValue="OFF">

  Determines whether to allow explicitly specifying the values of the column with the `AUTO_RANDOM` attribute in the `INSERT` statement.

</VersionVars>

</VersionVarsFilter>

And the MDLink component is a component that handles the link within the react like <MDLink url="/optimizer-hints#set_varvar_namevar_value">SET_VAR</MDLink> instead of the link in the markdown, like [SET_VAR](/[optimizer-hints.md](http://optimizer-hints.md/)#set_varvar_namevar_value).

Test markdown file.


Render result:

image
vercel[bot] commented 8 months ago

@Icemap is attempting to deploy a commit to the pingcap Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] commented 8 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
website-docs ❌ Failed (Inspect) Oct 31, 2023 6:11am
lilin90 commented 8 months ago

About the version type in the "Render result" section, is it necessary? Because for a System Variables page, all the content in this page apply to the version where you're (you can see it in url or the upper left version drop-down box).

Yuiham commented 8 months ago

How do you convert system-variables.md into the test markdown? Are there any tools or scripts available?

Icemap commented 8 months ago

How do you convert system-variables.md into the test markdown? Are there any tools or scripts available?

I used VS Code and regex to replace the major part of them. And the rest part I changed it manually.

Icemap commented 8 months ago

About the version type in the "Render result" section, is it necessary? Because for a System Variables page, all the content in this page apply to the version where you're (you can see it in url or the upper left version drop-down box).

Got it, I'll delete it then.

Icemap commented 8 months ago

The render result and test markdown file were updated.