This commit is contained in:
parent
5dfcdfd516
commit
c06f71a5ad
34 changed files with 3641 additions and 279 deletions
|
|
@ -319,6 +319,100 @@ Every bipartite graph satisfying Hall's condition has a matching...
|
|||
|
||||
Use the canonical Pandoc-style form for any material that should export to PDF.
|
||||
|
||||
## Data Tables
|
||||
|
||||
Use data tables when a post should keep rows in a colocated YAML or JSON file
|
||||
but render as a searchable, sortable table in Astro.
|
||||
|
||||
Canonical form:
|
||||
|
||||
````markdown
|
||||
```{.data-table #tbl:resources src="resources.yml" columns="type,title,summary" headers="type:Type,title:Resource,summary:Notes" link="title" number="slno" caption="Resources" search-placeholder="Search resources"}
|
||||
The HTML version renders this as a searchable, sortable table. In Obsidian,
|
||||
edit `resources.yml` to update the rows.
|
||||
```
|
||||
````
|
||||
|
||||
Attributes:
|
||||
|
||||
| Attribute | Required | Meaning |
|
||||
| ------------------------------ | -------- | ---------------------------------------------------------- |
|
||||
| `.data-table` | Yes | Marks this as a data-backed table. |
|
||||
| `#tbl:<id>` | Optional | HTML id and future cross-reference label. |
|
||||
| `src="resources.yml"` | Yes | YAML or JSON file path, resolved relative to the Markdown. |
|
||||
| `columns="type,title,summary"` | Optional | Visible columns and their order. |
|
||||
| `headers="key:Label,..."` | Optional | Human-readable labels for selected columns. |
|
||||
| `link="title"` | Optional | Column whose value links through the row's URL field. |
|
||||
| `url="link"` | Optional | URL field used by the linked column; defaults to `link`. |
|
||||
| `number="slno"` | Optional | Prefix the linked column with a row number field. |
|
||||
| `caption="Resources"` | Optional | Visible toolbar title and accessible table caption. |
|
||||
| `search="false"` | Optional | Disable local table search; enabled by default. |
|
||||
| `sort="false"` | Optional | Disable sortable headers; enabled by default. |
|
||||
| `search-placeholder="Search"` | Optional | Placeholder text for the search input. |
|
||||
| `pdf="Fallback text"` | Optional | PDF-specific fallback text. |
|
||||
| `fallback="Fallback text"` | Optional | General fallback text when `pdf` is absent. |
|
||||
|
||||
The data file should contain either a top-level array:
|
||||
|
||||
```yaml
|
||||
- slno: 01
|
||||
title: "Cognitive Productivity"
|
||||
summary: "Book by Luc P. Beaudoin."
|
||||
link: https://leanpub.com/cognitiveproductivity/
|
||||
type: book
|
||||
```
|
||||
|
||||
or an object with an `items` array:
|
||||
|
||||
```yaml
|
||||
items:
|
||||
- title: "Cognitive Productivity"
|
||||
summary: "Book by Luc P. Beaudoin."
|
||||
link: https://leanpub.com/cognitiveproductivity/
|
||||
type: book
|
||||
```
|
||||
|
||||
HTML output:
|
||||
|
||||
```html
|
||||
<section class="semantic-data-table" id="tbl:resources" data-data-table-root>
|
||||
<div class="data-table-toolbar">
|
||||
<h2>Resources</h2>
|
||||
<div class="data-table-search">...</div>
|
||||
</div>
|
||||
<div class="data-table-scroll">
|
||||
<table>
|
||||
...
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
<script>
|
||||
...
|
||||
</script>
|
||||
```
|
||||
|
||||
The generated table is static HTML. The inline script only adds local search and
|
||||
sort behavior; it does not fetch data at runtime.
|
||||
|
||||
PDF output:
|
||||
|
||||
```tex
|
||||
\begin{blogasidebox}{Resources}
|
||||
The HTML version renders a searchable, sortable data table from `resources.yml`.
|
||||
\end{blogasidebox}
|
||||
```
|
||||
|
||||
If the code fence has body text, or `pdf="..."`, that text is used as the PDF
|
||||
fallback. Full YAML-to-LaTeX table rendering is deliberately not implemented
|
||||
yet because long prose fields usually typeset better as curated PDF content.
|
||||
|
||||
Obsidian behavior:
|
||||
|
||||
- The fence stays readable in the note.
|
||||
- The YAML file remains a normal sidecar file you can edit directly.
|
||||
- Obsidian does not render the enhanced table unless a future vault plugin adds
|
||||
a preview renderer for `.data-table`.
|
||||
|
||||
## Interactive Blocks
|
||||
|
||||
Interactive blocks reserve a place for a React component in HTML and provide a
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue