Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demote headings appearing in markdown #166

Merged
merged 1 commit into from
Mar 13, 2024

Conversation

MatMoore
Copy link
Contributor

Currently, datahub can store arbitrary markdown in description fields. When we render this, it interferes with the normal heading structure of the page, because we have H1s following H3s etc.

This is partly a content problem - the documentation we've scraped from the preexisting data discovery tool is not designed for the new data catalogue - but we want the frontend to do the best it can even in the worst case scenario.

The mdx_headdown markdown extension fixes this problem by automatically demoting headings a number of levels depending on the context we are rendering in.

This solution isn't perfect, because sometimes layout headings use a smaller font size than the default for the corresponding level. Markdown rendered headings always use the default defined by the design system, so in such cases we may need to skip a level to get consistent sizing.

Before

Screenshot 2024-03-13 at 09 48 39
Screenshot 2024-03-13 at 09 48 32

After

Screenshot 2024-03-13 at 09 57 23
Screenshot 2024-03-13 at 09 59 51

Currently, datahub can store arbitrary markdown in description fields.
When we render this, it interferes with the normal heading structure of
the page, because we have H1s following H3s etc.

This markdown extension fixes this problem by automatically demoting
headings a number of levels depending on the context we are rendering
in.

This solution isn't perfect, because sometimes layout headings use a
smaller font size than the default for the corresponding level. Markdown
rendered headings always use the default defined by the design system,
so in such cases we may need to skip a level to get consistent sizing.
@MatMoore MatMoore marked this pull request as ready for review March 13, 2024 10:09
@MatMoore MatMoore merged commit aacd6e5 into main Mar 13, 2024
4 checks passed
@MatMoore MatMoore deleted the demote-unwanted-markdown-headings branch March 13, 2024 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants