It would be great to be able to include tables from separate files (Markdown and eventually even CSV) in a similar way to figures. It almost works using the `include` lua filter, but the table is not recognized as a table to be cross-referenced, see example here:

- https://gitlab.com/alping/quarto-test
- https://alping.gitlab.io/quarto-test/#results

````markdown
::: {#tbl-included}
```{.include}
tbl/sample-table-1.md
```

**Attempted Included Table.**
This is an attempt to include a table.
It almost works as the heading is placed in the correct place, but it is not recognized as a table and can't be referenced.
:::
````

I usually output Markdown/CSV tables from scripts which allows me to not have to manually change the manuscript every time the numbers change.

Possibly related to issue https://github.com/quarto-dev/quarto-cli/discussions/628.

Thank you for your work,
\- Peter

---

<details>
<summary>Discussed in https://github.com/quarto-dev/quarto-cli/discussions/609</summary>
<div type='discussions-op-text'>

<sup>Originally posted by **alping** April 11, 2022</sup>
Hi!

I do medical/epidemiological research and I've been using markdown and Pandoc for a long time to write my manuscripts. I've been keeping an eye on RMarkdown, Sweave, Knitr, Pweave and similar projects, and was very excited to recently discover Quarto. It's a fantastic project and I'm happy to see that it's being actively developed (thank you!). I'm trying out Quarto for writing my current manuscript and want to contribute some feedback that I hope can make Quarto even better.

I've put together a sample project which demonstrates most of the things I discuss here:
- https://gitlab.com/alping/quarto-test
- https://alping.gitlab.io/quarto-test/

### Enhancements

1. It would be great to be able to include tables from separate files (markdown or csv) in the same way we can do for figures. It almost works using the include lua filter, but the table is not recognized to be cross-referenced, see sample repo. (I usually output MD/CSV tables from scripts which allows me to not have to manually change them every time the numbers change).
2. Specify capitalization of Figure/figure and Table/table on a per reference basis, e.g. `@Fig-main` > Figure 1.1 and `@fig-main` > figure 1.1. Or `@fig-main` would give the default, `@^fig-main` > Figure 1.1, and `@_fig-main` > figure 1.1, or something similar.
3. A way to specify Supplementary Figures/Tables instead of a "hacky" solution involving chapters and `crossref: chapters: true` (see sample repo), so that we can get `Supplementary Figure 1` (with it's own counter separate from the main figures/tables). (This is used a lot in my field).
4. Table/Figure headers separate from table/figure text, possibly in bold font. E.g:
    > **Figure 1: Survival Function**
    > Survival function for entire population using...
5. Variables in inline text. E.g. `We identified {pop_size} patients...` > "We identified 3026 patients...". To avoid manually having to change these every time the numbers change. Variables could be read from a YAML or JSON file.
6. Make some parts only visible for specific render formats:
    ```
    ::: {.docx}
    This only shows up in .docx renders.
    :::
    ```
7. Make HTML preview remember the scroll location on reload. Now every time the page is changed and updated it jumps to the top, which makes it difficult to work on a specific section.

### Issues

1. Refs positioning not working for HTML, but for .docx. In HTML, references always show up at the end of the document.
    ```
    ::: {#refs}
    :::
    ```
2. No top margin for H1 in HTML render (weird spacing for chapters)
3. Printing HTML output causes cut text in page breaks in many cases, similar to what is shown here: https://stackoverflow.com/questions/55990473/htmlcss-page-breaks-cutting-text-characters-in-half-media-print

Again, fantastic project and thank you for your work.
\- Peter</div>
</details>
2022-04-14T08:40:46Z
alping
closed
Include Table from Separate Markdown File - Similar to Figures
https://github.com/quarto-dev/quarto-cli/issues/639