-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1530 from rzetelskik/docs-myst-parser-1.11
[v1.11] Replace recommonmark with MyST-Parser in docs
- Loading branch information
Showing
13 changed files
with
223 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,4 @@ examples/common/grafana/values.yaml | |
# additions for docs | ||
docs/_build | ||
source/.doctrees | ||
docs/**/*.pyc |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import os | ||
from recommonmark.transform import AutoStructify | ||
|
||
class BaseParser: | ||
def __init__(self, app): | ||
self.app = app | ||
|
||
def setup(self): | ||
raise NotImplementedError | ||
|
||
class RecommonmarkParser(BaseParser): | ||
def setup(self): | ||
try: | ||
self.app.setup_extension('recommonmark') | ||
self.app.setup_extension('sphinx_markdown_tables') | ||
|
||
self.app.add_config_value('recommonmark_config', { | ||
'enable_eval_rst': True, | ||
'enable_auto_toc_tree': False, | ||
}, True) | ||
self.app.add_transform(AutoStructify) | ||
except ImportError: | ||
raise RuntimeError("recommonmark and sphinx_markdown_tables are not installed!") | ||
|
||
class MystParser(BaseParser): | ||
def setup(self): | ||
try: | ||
self.app.setup_extension('myst_parser') | ||
self.app.config.myst_enable_extensions = ["colon_fence"] | ||
|
||
# TODO: https://github.com/scylladb/scylla-operator/issues/1421 | ||
# TODO: https://github.com/scylladb/scylla-operator/issues/1422 | ||
self.app.config.suppress_warnings = ["myst.xref_missing", "myst.header"] | ||
|
||
except ImportError: | ||
raise RuntimeError("myst-parser is not installed") | ||
|
||
def select_parser(app, config): | ||
if not config.scylladb_markdown_enable: | ||
return | ||
|
||
current_version = os.environ.get('SPHINX_MULTIVERSION_NAME', 'stable') | ||
|
||
config.source_suffix = { | ||
'.rst': 'restructuredtext', | ||
'.md': 'markdown', | ||
} | ||
|
||
if current_version in config.scylladb_markdown_recommonmark_versions: | ||
parser = RecommonmarkParser(app) | ||
else: | ||
parser = MystParser(app) | ||
|
||
parser.setup() | ||
|
||
def setup(app): | ||
app.add_config_value('scylladb_markdown_enable', True, 'env') | ||
app.add_config_value('scylladb_markdown_recommonmark_versions', [], 'env') | ||
app.connect('config-inited', select_parser) | ||
|
||
return { | ||
"version": "0.1", | ||
"parallel_read_safe": True, | ||
"parallel_write_safe": True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,9 @@ cd examples/gke | |
# ./gke.sh -u [email protected] -p gke-demo-226716 -z us-west1-b | ||
``` | ||
|
||
:warning: Make sure to pass a ZONE (ex.: us-west1-b) and not a REGION (ex.: us-west1) or it will deploy nodes in each ZONE available in the region. | ||
:::{warning} | ||
Make sure to pass a ZONE (ex.: us-west1-b) and not a REGION (ex.: us-west1) or it will deploy nodes in each ZONE available in the region. | ||
::: | ||
|
||
After you deploy, see how you can [benchmark your cluster with cassandra-stress](#benchmark-with-cassandra-stress). | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.