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

Pass extra data (fe. accountIDs) to HTMLToMarkdown method & add possibility to disable certain rules #686

Conversation

robertKozik
Copy link
Contributor

@robertKozik robertKozik commented Apr 18, 2024

This PR consists of two different changes

  1. htmlToMarkdown method now has additional, optional argument extras this argument adds the possibility to pass extra data which can be used in replacement function. For now is used to pass accountID to name and reportID to name maps
  2. replace method has additional object key disabledRules. Every rule name from this array will be skipped in parsing.

Fixed Issues

$ Expensify/App#40480
Expensify/App#39550

Tests

  1. What unit/integration tests cover your change? What autoQA tests cover your change?
    The changes, which this PR introduces, allows to more precisely interact with parser. To be precise, now we will be able to pass application state to the parser itself. We wrote couple of unit tests which mocks passing extras object with account ID and reportID maps to ensure that parsing shortened room and user mentions tags works as intended.

  2. What tests did you perform that validates your changed worked?
    We also tested our changes inside E/App. It's not yet supported on main branch, but all changes worked as intended

QA

  1. What does QA need to do to validate your changes?
    These changes cannot be tested on E/App yet. Only follow-up PR will be using these changes
  2. What areas to they need to test for regressions?
    As we were touching methods responsible for both HTML –> markdown and markdown -> HTML we should look for regressions in every rule and parsing.

Copy link

github-actions bot commented Apr 18, 2024

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@war-in
Copy link
Contributor

war-in commented Apr 19, 2024

I have read the CLA Document and I hereby sign the CLA

lib/ExpensiMark.js Outdated Show resolved Hide resolved
lib/ExpensiMark.js Show resolved Hide resolved
lib/ExpensiMark.js Show resolved Hide resolved
lib/ExpensiMark.js Show resolved Hide resolved
@robertKozik robertKozik marked this pull request as ready for review April 19, 2024 10:08
@robertKozik robertKozik requested a review from a team as a code owner April 19, 2024 10:08
@robertKozik
Copy link
Contributor Author

CC. @rlinoz

@melvin-bot melvin-bot bot requested review from grgia and removed request for a team April 19, 2024 10:08
Copy link
Contributor

@rlinoz rlinoz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just one question

declare type Name =
| 'codeFence'
| 'inlineCodeBlock'
| 'email'
| 'link'
| 'hereMentions'
| 'roomMentions'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused, why we need the roomMentions here if we renamed it o reportMentions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Missed that while implementing

Copy link
Contributor

@rlinoz rlinoz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@rlinoz
Copy link
Contributor

rlinoz commented Apr 23, 2024

Merging to unblock other issues

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.

None yet

3 participants