Skip to content

Commit

Permalink
fix(nx-dev): fix markdoc table data alignment (#28274)
Browse files Browse the repository at this point in the history
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

Currently, our table heading generated from markdown files `.md` are
positioned `center` while the data `td` are positioned `left`.

It doesn't look uniform and on larger tables, it can be jarring.

Examples:
- https://nx.dev/ci/reference/release-notes#helm-package-compatibility
- https://nx.dev/reference/releases#supported-versions
-
https://nx.dev/blog/reliable-ci-a-new-execution-model-fixing-both-flakiness-and-slowness#problem-in-numbers

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
Both heading and data should have the same alignment to be symmetrical.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #

(cherry picked from commit 5be5ad8)
  • Loading branch information
ndcunningham authored and FrozenPandaz committed Oct 3, 2024
1 parent 7a1220c commit fe8a099
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion nx-dev/ui-markdoc/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ import { pill } from './lib/tags/pill.schema';
import { fence } from './lib/nodes/fence.schema';
import { FenceWrapper } from './lib/nodes/fence-wrapper.component';
import { VideoPlayer, videoPlayer } from './lib/tags/video-player.component';

import { td } from './lib/nodes/td.schema';
// TODO fix this export
export { GithubRepository } from './lib/tags/github-repository.component';

Expand All @@ -70,6 +70,7 @@ export const getMarkdocCustomConfig = (
heading: getHeadingSchema(headingClass),
image: getImageSchema(documentFilePath),
link,
td,
},
tags: {
callout,
Expand Down
8 changes: 8 additions & 0 deletions nx-dev/ui-markdoc/src/lib/nodes/td.schema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Schema } from '@markdoc/markdoc';

export const td: Schema = {
render: 'td',
attributes: {
className: { type: 'String', default: 'text-center' },
},
};

0 comments on commit fe8a099

Please sign in to comment.