-
Notifications
You must be signed in to change notification settings - Fork 11
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
feat: human-readable display for back matter media types #861
Conversation
packages/oscal-react-library/src/components/oscal-utils/OSCALLinkUtils.ts
Outdated
Show resolved
Hide resolved
Todo:
|
bf79164
to
0ae16eb
Compare
0ae16eb
to
b0e4a75
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking really good so far. After seeing your implementation, I now agree mime-db
is the better choice here.
packages/oscal-react-library/src/components/oscal-utils/OSCALMediaTypeUtils.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good so far @kylelaker! I'm liking the choices you've made with capturing and formatting the media types are great and I think "Unrecognized" is a good fallback for when the media type isn't found.
packages/oscal-react-library/src/components/oscal-utils/OSCALMediaTypeUtils.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your work on this @kylelaker! I appreciate the documentation providing more reasoning on the less clear parts of the code.
This updates how we display resources in Back Matter to try to use a more human-readable name. When
media-type
is provided, we prefer that; otherwise we fallback to guessing based on the file extension using themime-db
package's database (which includes registrations with IANA as well as the Nginx and Apache databases).The media types are largely those defined in #111 though with some additional ones found during the implementation that may be useful. The lookup algorithm is not significantly modified besides the feedback given in the issue comments.
The UI is also updated slightly to give more visual indication that it's a button and can be clicked to open the link.
Closes: #111
Screenshots
General Display:
OSCAL Media Types: