-
Notifications
You must be signed in to change notification settings - Fork 8
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
Rich text viewer | Implementation of markdown parser #1335
Rich text viewer | Implementation of markdown parser #1335
Conversation
…kage in tiptap/pm is vulnerable
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.
I am approving this PR to unblock you next week as I will be out of office, otherwise would take another pass.
Pls go through the comments and address them as necessary.
packages/nimble-components/src/rich-text-viewer/testing/rich-text-viewer.pageobject.ts
Outdated
Show resolved
Hide resolved
packages/nimble-components/src/rich-text-viewer/testing/rich-text-viewer.pageobject.ts
Outdated
Show resolved
Hide resolved
packages/nimble-components/src/rich-text-viewer/tests/rich-text-viewer.spec.ts
Outdated
Show resolved
Hide resolved
packages/nimble-components/src/rich-text-viewer/tests/rich-text-viewer.spec.ts
Outdated
Show resolved
Hide resolved
moved to thread: #1335 (comment) |
packages/nimble-components/src/rich-text-viewer/testing/rich-text-viewer.pageobject.ts
Outdated
Show resolved
Hide resolved
packages/nimble-components/src/rich-text-viewer/tests/rich-text-viewer-matrix.stories.ts
Outdated
Show resolved
Hide resolved
packages/nimble-components/src/rich-text-viewer/tests/rich-text-viewer-matrix.stories.ts
Show resolved
Hide resolved
# Pull Request ## 🤨 Rationale Updates dependencies to the latest resolved by our package.json files without modifying those specifiers. Hoping it pre-emptively helps the discussion of [issues around dependency changes](#1335 (comment)) but useful regardless. As a bonus, fixes #1146 ## 👩💻 Implementation - Regenerate the lock file (delete lock file, node_modules, and npm install) - Update CI node and npm version to reflect Skyline recent update and better reflect local dev - Pin Blazor playwright version to correspond to latest released on nuget.org (as of writing [1.36.0](https://www.nuget.org/packages/Microsoft.Playwright)) vs latest released on npm which the previous specifier would resolve to (as of writing [1.36.1](https://www.npmjs.com/package/playwright)). - Update tests and stories based on lint rule behavior changes ## 🧪 Testing Manual test storybook build but rely on CI for most. ## ✅ Checklist - [x] I have updated the project documentation to reflect my changes or determined no changes are needed. --------- Co-authored-by: Malcolm Smith <[email protected]>
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.
Approved assuming default normalization is re-enabled with test cases added
packages/nimble-components/src/rich-text-viewer/tests/rich-text-viewer.spec.ts
Outdated
Show resolved
Hide resolved
packages/nimble-components/src/rich-text-viewer/tests/rich-text-viewer.spec.ts
Outdated
Show resolved
Hide resolved
…ttps://github.com/ni/nimble into users/vivin/viewer-markdown-parser-implementation
You're good to merge this PR this whenever you're ready! (No need to wait on the last reviewer) |
# Pull Request ## 🤨 Rationale Fixes #1700 These two polyfills were added in #1335 because markdown-it implicitly depended on some functionality that existed in Node but not browser environments. We've since upgraded markdown-it to a version that expresses those dependencies on normal npm packages, so the polyfills are no longer needed. markdown-it/markdown-it#967 ## 👩💻 Implementation Remove rollup plugins and npm dependencies on those plugins that were added in #1335. ## 🧪 Testing Mostly depending on PR build but also spot checking rich text functionality in storybook. ## ✅ Checklist <!--- Review the list and put an x in the boxes that apply or ~~strike through~~ around items that don't (along with an explanation). --> - [x] I have updated the project documentation to reflect my changes or determined no changes are needed.
Pull Request
🤨 Rationale
This PR includes the logic for parsing markdown input and rendering the rich text content into the viewer component.
Issue: #1288
AzDo User Story: Show the rich text content by parsing the markdown input
👩💻 Implementation
markdownValue
accessors to allow setting and retrieving the markdown value. When setting the markdown input string, the component performs operations to convert the markdown string into corresponding document fragments for loading it into the container of the viewer component.emphasis
,list
, andautolink
from the markdown-it, which is internally used by prosemirror-markdown. This allows users to add bold, italics, numbered, and bulleted lists, as well as direct links in a CommonMark flavor. All other basic markdown formats are disabled.json()
from the "@rollup/plugin-json" in the rollup.config.js because prosemirror-markdown and markdown-it internally use JSON files during the build process. Referred to this solution from the discussion here.nodePolyfills()
from rollup-plugin-polyfill-node as themarkdown-it
requirespunycode
(code reference) but as mentioned in the punycode, the right way to use it isrequire('punycode/')
. So usenodePolyfills()
to rollup the bundle with thepunycode
properly imported in theall-components.bundle.js
.Spec update:
comments
desktop and mobile mockup links and updated a few GitHub permalinks.fit-to-content
attribute for the viewer component.markdown
accessor is changed to a property for the viewer component.🧪 Testing
Added unit tests and manually tested and verified the changes.
✅ Checklist