Document Editing Guidelines

Adding a Markdown File

Add a markdown file to the contents/zh/ (Chinese posts) or contents/en/ (English posts) directories, up to three levels. Update the path and title information in contents/zh/posts.yml or contents/en/posts.yml.

Lowercase markdown file names.

Using Prettier to Automatically Format Code

Before you start, we recommend installing the prettier VSCode plugin, which will automatically format the code for you when you save it.

If you feel that the automatic formatting is breaking your code block, you can add the following comment to prevent prettier from formatting the code inside the block

<!-- prettier-ignore-start -->
<!-- prettier-ignore-end -->

If you find blocks of code that are not formatted, check first for syntax errors in the code.

Built-in Variables

  • optionPath
  • mainSitePath
  • exampleViewPath
  • exampleEditorPath
  • lang

Usage:

${xxxxx}
[Get Apache ECharts](${lang}/basics/download)

Get Apache ECharts

Embedding Code

Basic Usage

```js
option = {
    series: [{
        type: 'bar',
        data: [23, 24, 18, 25, 27, 28, 25]
    }]
};
\```
option = {
  series: [
    {
      type: 'bar',
      data: [23, 24, 18, 25, 27, 28, 25]
    }
  ]
};

In order to allow the tool to help us format the code, we should try to avoid syntactically problematic writing styles.

For example, the comment ...

option = {
  series: [
    {
      type: 'bar'
      // ...
    }
  ]
};

Live Preview and Editing

Currently only preview of Option code is supported

\```js live
option = {
  xAxis: {
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {},
  series: [
    {
      type: 'bar',
      data: [23, 24, 18, 25, 27, 28, 25]
    }
  ]
};
\```
option = {
  xAxis: {
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {},
  series: [
    {
      type: 'bar',
      data: [23, 24, 18, 25, 27, 28, 25]
    }
  ]
};
live

More Preview Layouts

Left to Right

<md-live lang="js" code="'b3B0aW9uID0gew0KICAuLi4NCn07DQpcYGBg'" v-bind="{layout: 'lr'}" />

<!-- prettier-ignore-end -->

<md-live lang="js" code="'b3B0aW9uID0gew0KICB4QXhpczogew0KICAgIGRhdGE6IFsnTW9uJywgJ1R1ZScsICdXZWQnLCAnVGh1JywgJ0ZyaScsICdTYXQnLCAnU3VuJ10NCiAgfSwNCiAgeUF4aXM6IHt9LA0KICBzZXJpZXM6IFsNCiAgICB7DQogICAgICB0eXBlOiAnYmFyJywNCiAgICAgIGRhdGE6IFsyMywgMjQsIDE4LCAyNSwgMjcsIDI4LCAyNV0NCiAgICB9DQogIF0NCn07'" v-bind="{layout: 'lr'}" />

#### Right to left

<!-- prettier-ignore-start -->
markdown
option = {
  ...
};
\```
live

option = {
  xAxis: {
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {},
  series: [
    {
      type: 'bar',
      data: [23, 24, 18, 25, 27, 28, 25]
    }
  ]
};
live

Down to Up

<md-live lang="js" code="'b3B0aW9uID0gew0KICAuLi4NCn07DQpcYGBg'" v-bind="{layout: 'bt'}" />

<!-- prettier-ignore-end -->

<md-live lang="js" code="'b3B0aW9uID0gew0KICB4QXhpczogew0KICAgIGRhdGE6IFsnTW9uJywgJ1R1ZScsICdXZWQnLCAnVGh1JywgJ0ZyaScsICdTYXQnLCAnU3VuJ10NCiAgfSwNCiAgeUF4aXM6IHt9LA0KICBzZXJpZXM6IFsNCiAgICB7DQogICAgICB0eXBlOiAnYmFyJywNCiAgICAgIGRhdGE6IFsyMywgMjQsIDE4LCAyNSwgMjcsIDI4LCAyNV0NCiAgICB9DQogIF0NCn07'" v-bind="{layout: 'bt'}" />

### Highlighting Lines of Code and Adding Filenames

Use.

<!-- prettier-ignore-start -->
markdown

option = {
  series: [
    {
      type: 'bar',
      data: [23, 24, 18, 25, 27, 28, 25]
    }
  ]
};
\```

Effects.

option = {
  series: [
    {
      type: 'bar',
      data: [23, 24, 18, 25, 27, 28, 25]
    }
  ]
};

Embedding Images

Source images are stored under static/images/.

![image description](images/demo.png)

Set the Image Height and Width

For the temporary style of the current page, you can just write html.

<img data-src="images/demo.png" style="width: 50px" />

Add Example Iframe

src is the string after ?c= in the https://echarts.apache.org/examples/en/editor.html?c=line-simple address

Use:

<md-example src="doc-example/getting-started" width="100%" height="300"></md-example>

Result:

Use:

<md-option link="series-bar.itemStyle.color"></md-option>

Result: series-bar.itemStyle.color

More Component Usage

The documentation supports the use of globally registered markdown components. In addition to the md-example component just described, the following components are also available

md-alert

Prompt components

<md-alert type="info">
This is an info alert.
</md-alert>

This is an info alert.

<md-alert type="success">
This is a success alert.
</md-alert>

This is a success alert.

<md-alert type="warning">
This is a warning alert.
</md-alert>

This is a warning alert.

<md-alert type="danger">
This is a danger alert.
</md-alert>

This is a danger alert.

Contributors Edit this page on GitHub