docsy icon indicating copy to clipboard operation
docsy copied to clipboard

Support easy disabling of Docsy styles for HTML elements

Open chalin opened this issue 2 years ago • 2 comments

Docsy defaults are good most of the time, but now and again it would be convenient if they could be easily disabled. For example, consider the following excerpt from https://github.com/google/docsy/blob/main/assets/scss/_content.scss:

.td-content {
    // ...
    table {
        @extend .table-striped;
        @extend .table-responsive;
        @extend .table;
    }
    // ...
}

To disable, we could use a special class named, say, td-initial to be used like this:

.td-content {
    // ...
    table:not(.td-initial) {
        @extend .table-striped;
        @extend .table-responsive;
        @extend .table;
    }
    // ...
}

In markdown, one could now write something like this to recover the base styles of one specific table:

| Element     | Attribute   |
| ----------- | ----------- |
| Header      | Title       |
| Paragraph   | Text        |
{.td-initial}

provided markdown attributes are enabled for blocks.

Thoughts @LisaFC et al.? I've come across the need for this and implemented it elsewhere -- see https://github.com/open-telemetry/opentelemetry.io/pull/2359.

Tasks:

  • [x] Tables - #1477

Related:

  • #1655
  • https://github.com/google/docsy/pull/1255#issuecomment-1307493517

chalin avatar Feb 17 '23 16:02 chalin

+1 for this, it means (I think) that people will find it easier to keep in sync w/Docsy if they can just disable the styles they don't want rather than having to reapply patches?

emckean avatar Feb 17 '23 18:02 emckean

Yes, that in particular.

chalin avatar Feb 22 '23 22:02 chalin