Skip to content

Move hardcoded Tailwind table-cell classes out of Render.hs #18

@srid

Description

@srid

The Pandoc table renderer in src/Heist/Extra/Splices/Pandoc/Render.hs:101-120 hardcodes Tailwind utility classes onto every emitted <th>/<td>/<tr>:

```hs
let borderStyle = "border-gray-300"
rowStyle = [("class", "border-b-2 border-t-2 " <> borderStyle)]
cellStyle = [("class", "py-2 px-2 align-top border-r-2 border-l-2 " <> borderStyle)]
tableAttr = ("", ["mb-3"], mempty)
```

There's already a -- TODO: Move tailwind styles to pandoc.tpl note next to the table case. Filing this so it doesn't get forgotten.

Why it bites

  • Consumer themes that don't use Tailwind get unstyled output, but every emitted table still carries the Tailwind class strings — surface area pollution.
  • Consumer themes that do use Tailwind but want a different table aesthetic (e.g. only horizontal row separators, no vertical cell borders, or a <table class=\"prose-table\">-style hook) have to fight the hardcoded classes with !important overrides — for example, Default theme refresh: attached card, chip palette, heatmap timeline emanote#699 ships a main table th, main table td { border-left-width: 0 !important; ... } block in styles.tpl solely to neutralize the cell borders heist-extra forced on.
  • Any future palette swap (theme primary, neutral grays, dark-mode tokens) has no way to reach into these strings without a heist-extra release.

Suggested shape

Mirror what the renderer already does for other Pandoc blocks (<CodeBlock>, <BlockQuote>, etc.): emit the structural element with no class, and expose Heist tags so the consumer template owns the styling. Something like:

```html

\`\`\`

Then pandoc.tpl in each consumer chooses what classes (if any) to put on each level. Consumers who want today's behavior get the same strings via their own template; consumers who want plain <table> HTML drop the classes; consumers who want different styling apply different ones.

Workaround in the meantime

```css
main table th,
main table td {
border-left-width: 0 !important;
border-right-width: 0 !important;
}
main table thead tr,
main table tbody tr {
border-top-width: 0 !important;
}
```

(See srid/emanote#699 for the in-the-wild override.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions