This is an automated email from the ASF dual-hosted git repository. sushuang pushed a commit to branch axis-break-enhance in repository https://gitbox.apache.org/repos/asf/echarts-doc.git
commit 4f2184a3c402f16e273703b3a765222ad937edda Author: 100pah <[email protected]> AuthorDate: Fri Aug 22 01:46:22 2025 +0800 Add global variables for link in code block. --- README.md | 48 +++++++++++++++++++++++++++--------------------- config/env.asf.js | 2 ++ config/env.dev.js | 2 ++ config/env.localsite.js | 2 ++ 4 files changed, 33 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index f8ce8fe0..9113c1cb 100644 --- a/README.md +++ b/README.md @@ -60,15 +60,36 @@ For example, ### Global Variables These global variables can be used in doc: -+ `${galleryViewPath}` -+ `${galleryEditorPath}` -+ `${websitePath}` -+ `${handbookPath}` - -Note: All of them are ended with a `/`, therefore, use them like `${galleryEditorPath}pie-legend`. ++ `${galleryViewPath}`: Use it like `${galleryViewPath}pie-legend`. ++ `${galleryEditorPath}`: Use it like `${galleryEditorPath}pie-legend`. ++ `${optionDocPath}`: Use it like `${optionDocPath}#xAxis.type`. ++ `${apiDocPath}`: Use it like `${apiDocPath}#echarts.init`. ++ `${handbookPath}`: Use it like `${handbookPath}basics/import`. ++ `${websitePath}`: Use it like `${websitePath}/examples/en/index.html#chart-type-custom`. See samples in "Reference of echarts-examples or other links" +### Reference of Other ECharts Option + +A `~` can be used to refer to a option item in the same doc. For example: +```md +[xAxis.name](~xAxis.name) +``` + +To reference an anchor in different doc, it can be: +```md +[itemStyle](option.html#series.itemStyle) +[action.highlight](api.html#action.highlight) +[Custom Series](tutorial.html#Custom%20Series) +[Use ECharts with bundler and NPM](${handbookPath}basics/import) +``` + +To add references in a code block, we have to: +```md +// See doc: ${optionDocPath}#series-bar.select +// See doc: ${apiDocPath}#echarts.init +``` + ### Reference of echarts-examples or Other Links Embed an example in doc (display the example directly in doc with an iframe. To avoid performance issues, do not overuse it.): @@ -88,21 +109,6 @@ Provide a website link in doc: [Apache ECharts website](${websitePath}/en/download.html) ``` -### Reference of Other ECharts Option - -A `~` can be used to refer to a option item in the same doc. For example: -```md -[xAxis.name](~xAxis.name) -``` - -If intending to reference an anchor in different doc, it can be: -```md -[itemStyle](option.html#series.itemStyle) -[action.highlight](api.html#action.highlight) -[Custom Series](tutorial.html#Custom%20Series) -[Use ECharts with bundler and NPM](${handbookPath}basics/import) -``` - ### Notice diff --git a/config/env.asf.js b/config/env.asf.js index df548736..9bc9c956 100644 --- a/config/env.asf.js +++ b/config/env.asf.js @@ -3,6 +3,8 @@ const path = require('path'); module.exports = { galleryViewPath: 'https://echarts.apache.org/examples/${lang}/view.html?c=', galleryEditorPath: 'https://echarts.apache.org/examples/${lang}/editor.html?c=', + optionDocPath: 'https://echarts.apache.org/${lang}/option.html', + apiDocPath: 'https://echarts.apache.org/${lang}/api.html', handbookPath: 'https://echarts.apache.org/handbook/${lang}/', websitePath: 'https://echarts.apache.org', diff --git a/config/env.dev.js b/config/env.dev.js index 127270d4..cdcb030c 100644 --- a/config/env.dev.js +++ b/config/env.dev.js @@ -3,6 +3,8 @@ const path = require('path'); module.exports = { galleryViewPath: 'http://localhost/echarts-website/examples/${lang}/view.html?c=', galleryEditorPath: 'http://localhost/echarts-website/examples/${lang}/editor.html?c=', + optionDocPath: 'https://echarts.apache.org/${lang}/option.html', + apiDocPath: 'https://echarts.apache.org/${lang}/api.html', handbookPath: 'http://localhost/echarts-website/handbook/${lang}/', websitePath: 'http://localhost/echarts-website', diff --git a/config/env.localsite.js b/config/env.localsite.js index 242b29b7..91550c65 100644 --- a/config/env.localsite.js +++ b/config/env.localsite.js @@ -3,6 +3,8 @@ const path = require('path'); module.exports = { galleryViewPath: 'http://localhost/echarts-website/examples/${lang}/view.html?c=', galleryEditorPath: 'http://localhost/echarts-website/examples/${lang}/editor.html?c=', + optionDocPath: 'https://echarts.apache.org/${lang}/option.html', + apiDocPath: 'https://echarts.apache.org/${lang}/api.html', handbookPath: 'http://localhost/echarts-website/handbook/${lang}/', websitePath: './', --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
