-
Notifications
You must be signed in to change notification settings - Fork 66
docs: add a how-to guide for data tables #451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 11 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
d0a2554
add first draft of data tables guide
dwilding 7d64d89
Merge remote-tracking branch 'upstream/main' into datatables-guide
dwilding 699ab17
add data tables guide to index
dwilding 3fa9599
Merge remote-tracking branch 'upstream/main' into datatables-guide
dwilding 4505d59
add details about Sphinx DataTables
dwilding 79abfe7
adjust wording
dwilding d71b78b
update landing page per suggestion
dwilding ab0f4c6
adjust wording
dwilding a1bf44f
mention new doc in CHANGELOG
dwilding e3fe5f5
remove full stop
dwilding 74f1ac1
put links in alphabetical order
dwilding 276cddd
use reST formatting
dwilding 9013272
explain purpose of links and remove duplicated links
dwilding b7f896a
improve wording per review
dwilding 8e2060c
Merge remote-tracking branch 'upstream/main' into datatables-guide
dwilding File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,139 @@ | ||
| .. _create-data-tables: | ||
|
|
||
| Create data tables | ||
| =================== | ||
|
|
||
| The starter pack can render comma-separated values (CSV) data as tables. | ||
|
|
||
| For other types of table, see :ref:`tables in reStructuredText <style-guide-tables>` and :ref:`tables in MyST <myst_style_guide_tables>`. | ||
|
|
||
| Create a table from inline data | ||
| ------------------------------- | ||
|
|
||
| If you have a small amount of CSV data, you can include the data in the doc source. For example: | ||
|
|
||
| .. tab-set:: | ||
|
|
||
| .. tab-item:: Table | ||
|
|
||
| .. csv-table:: | ||
| :header: "Animal", "Number of legs", "Size" | ||
|
|
||
| "Worm", 0, "Small" | ||
| "Penguin", 2, "Medium" | ||
| "Horse", 4, "Large" | ||
| "Ant", 6, "Small" | ||
| "Octopus", 8, "Medium" | ||
|
|
||
| .. tab-item:: reST | ||
|
|
||
| .. code-block:: none | ||
dwilding marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| .. csv-table:: | ||
| :header: "Animal", "Number of legs", "Size" | ||
|
|
||
| "Worm", 0, "Small" | ||
| "Penguin", 2, "Medium" | ||
| "Horse", 4, "Large" | ||
| "Ant", 6, "Small" | ||
| "Octopus", 8, "Medium" | ||
|
|
||
| See `csv-table (reST)`_. | ||
dwilding marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| .. tab-item:: MyST | ||
|
|
||
| .. code-block:: none | ||
|
|
||
| ```{csv-table} | ||
| :header: "Animal", "Number of legs", "Size" | ||
|
|
||
| "Worm", 0, "Small" | ||
| "Penguin", 2, "Medium" | ||
| "Horse", 4, "Large" | ||
| "Ant", 6, "Small" | ||
| "Octopus", 8, "Medium" | ||
| ``` | ||
|
|
||
| See `csv-table (MyST)`_. | ||
|
|
||
| Create a table from a CSV file | ||
| ------------------------------ | ||
|
|
||
| If you have a large amount of CSV data, or the data is generated by an automated process, you can include the data from a file. For example: | ||
|
|
||
| .. tab-set:: | ||
|
|
||
| .. tab-item:: Table | ||
|
|
||
| .. csv-table:: | ||
| :header: "Animal", "Number of legs", "Size" | ||
|
|
||
| "Worm", 0, "Small" | ||
| "Penguin", 2, "Medium" | ||
| "Horse", 4, "Large" | ||
| "Ant", 6, "Small" | ||
| "Octopus", 8, "Medium" | ||
|
|
||
| .. tab-item:: reST | ||
|
|
||
| .. code-block:: none | ||
|
|
||
| .. csv-table:: | ||
| :file: /reuse/animals.csv | ||
| :header-rows: 1 | ||
|
|
||
| See `csv-table (reST)`_. | ||
|
|
||
| .. tab-item:: MyST | ||
|
|
||
| .. code-block:: none | ||
|
|
||
| ```{csv-table} | ||
| :file: /reuse/animals.csv | ||
| :header-rows: 1 | ||
| ``` | ||
|
|
||
| See `csv-table (MyST)`_. | ||
|
|
||
| .. tab-item:: ``docs/reuse/animals.csv`` | ||
|
|
||
| .. code-block:: none | ||
|
|
||
| "Animal", "Number of legs", "Size" | ||
| "Worm", 0, "Small" | ||
| "Penguin", 2, "Medium" | ||
| "Horse", 4, "Large" | ||
| "Ant", 6, "Small" | ||
| "Octopus", 8, "Medium" | ||
|
|
||
| Create an interactive table | ||
| --------------------------- | ||
|
|
||
| The `Sphinx DataTables`_ extenstion enables your tables to become interactive. Your readers will be able to sort columns and filter rows. For examples, see the extension's documentation. | ||
dwilding marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
dwilding marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| The extension isn't available by default in the starter pack. | ||
|
|
||
| To include the extension in your documentation, add ``sphinx-datatables`` to ``docs/requirements.txt``. Then add ``sphinx_datatables`` to the ``extensions`` list in ``docs/conf.py``. | ||
|
|
||
| After including the extension, use the ``sphinx-datatable`` class to make tables interactive. For example: | ||
|
|
||
| .. tab-set:: | ||
|
|
||
| .. tab-item:: reST | ||
|
|
||
| .. code-block:: none | ||
|
|
||
| .. csv-table:: | ||
| :class: sphinx-datatable | ||
| :file: /reuse/animals.csv | ||
| :header-rows: 1 | ||
|
|
||
| .. tab-item:: MyST | ||
|
|
||
| .. code-block:: none | ||
|
|
||
| ```{csv-table} | ||
| :class: sphinx-datatable | ||
| :file: /reuse/animals.csv | ||
| :header-rows: 1 | ||
| ``` | ||
dwilding marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.