{"id":22741842,"url":"https://github.com/t2bot/node-email-reply-parser","last_synced_at":"2025-04-09T16:06:12.422Z","repository":{"id":37854593,"uuid":"83155568","full_name":"t2bot/node-email-reply-parser","owner":"t2bot","description":"A port of willdurand/EmailReplyParser (which is a port of github/email_reply_parser) to nodejs","archived":false,"fork":false,"pushed_at":"2024-06-17T06:08:18.000Z","size":140,"stargazers_count":65,"open_issues_count":5,"forks_count":16,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-09T16:06:06.241Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/t2bot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-25T19:10:27.000Z","updated_at":"2025-01-20T12:45:10.000Z","dependencies_parsed_at":"2022-08-19T09:12:31.828Z","dependency_job_id":null,"html_url":"https://github.com/t2bot/node-email-reply-parser","commit_stats":null,"previous_names":["turt2live/node-email-reply-parser"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/t2bot%2Fnode-email-reply-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/t2bot%2Fnode-email-reply-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/t2bot%2Fnode-email-reply-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/t2bot%2Fnode-email-reply-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/t2bot","download_url":"https://codeload.github.com/t2bot/node-email-reply-parser/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248065289,"owners_count":21041871,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-11T00:18:53.481Z","updated_at":"2025-04-09T16:06:12.407Z","avatar_url":"https://github.com/t2bot.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-email-reply-parser\n\n[![npm version](https://badge.fury.io/js/node-email-reply-parser.svg)](https://www.npmjs.com/package/node-email-reply-parser)\n\nA port of willdurand/EmailReplyParser (which is a port of github/email_reply_parser) to nodejs\n\nwilldurand's port of the Github library supports multiple spoken languages and has some enhanced parsing and therefore was used as a template for this library.\n\n\n# Installing\n\nThis package can be found on [npm](https://www.npmjs.com/):\n```\nnpm install node-email-reply-parser\n```\n\n**Note**: This package is ES6 compatible and does *not* transpile automatically.\n\n\n# Usage\n\n```\nvar replyParser = require(\"node-email-reply-parser\");\n\nvar email = replyParser(emailContent);\n```\n\n`email` has two primary methods:\n* `getFragments()`: returns all the fragments of the email\n* `getVisibleText()`: returns the text that is considered 'visible'\n\n`getVisibleText()` accepts an optional options object:\n\n```\ngetVisibleText({aggressive: true})\n```\n\nSetting `aggressive` to true will make the parser assume that any fragment which is not hidden, but which is both preceded and followed by a hidden fragment, should not be visible. This works around the issue of clients breaking quoted text into multiple lines (e.g. Gmail).\n\nUsing aggressive mode runs the risk of losing visible lines which are interspersed with quoted lines, but is useful when parsing e.g. emails from a 'reply by email' feature which contain a large block of quoted text.\n\nA fragment has the following functions:\n* `getContent()`: returns the content of the fragment\n* `isSignature()`: returns whether or not the fragment is likely a signature\n* `isQuoted()`: returns whether or not the fragment is likely a quote\n* `isHidden()`: returns whether or not the text is considered 'hidden'\n* `isEmpty()`: returns whether or not the fragment has any content\n\nPassing `true` as the second argument to `replyParser` will have the return value be just the visible text:\n```\n$visibleText = replyParser($emailContent, true);\n```\n\n# Known Issues\n\nThe parser is not able to pick up some of the edge cases. They are outlined below.\n\n## Quoted Headers\n\nQuoted headers aren't picked up if there's an extra line break:\n```\nOn \u003cdate\u003e, \u003cauthor\u003e wrote:\n\n\u003e blah\n```\n\nThey also aren't picked up if the email client breaks it up into multiple lines, like gmail and it's 80 column automatic limit:\n```\nOn \u003cdate\u003e, \u003cauthor\u003e\nwrote:\n\u003e blah\n```\n\n## Weird Signatures\n\nLines starting with `-` or `_` sometimes mark the beginning of signatures:\n```\nHello\n\n--\nRick\n```\n\nNot everyone follows this convention:\n```\nHello\n\nMr Rick Olson\nGalactic President Superstar Mc Awesomeville\nGitHub\n\n**********************DISCLAIMER***********************************\n* Note: blah blah blah                                            *\n**********************DISCLAIMER***********************************\n```\n\n## Strange Quoting\n\nApparently, prefixing lines with `\u003e` isn't universal either:\n\n```\nHello\n\n--\nRick\n\n________________________________________\nFrom: Bob [reply@reply.github.com]\nSent: Monday, March 14, 2011 6:16 PM\nTo: Rick\n```\n\n\n# Unit Tests\n\nInstall the required dependencies:\n```\nnpm install --dev\n```\n\nRun the tests:\n```\nnpm test\n```\n\n\n# Contributing\n\nPlease see the CONTRIBUTING.md file.\n\n\n# Credits\n\n* GitHub - Amazing Ruby gem for parsing emails\n* William Durand [william.durand1@gmail.com](mailto:william.durand1@gmail.com) - Extensive PHP version of GitHub's library\n\n\n# License\n\nnode-email-reply-parser is released under the MIT Licenses. Please see the bundled LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ft2bot%2Fnode-email-reply-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ft2bot%2Fnode-email-reply-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ft2bot%2Fnode-email-reply-parser/lists"}