{"id":16994708,"url":"https://github.com/dandv/discourse-post-process","last_synced_at":"2025-04-12T05:26:14.712Z","repository":{"id":66892177,"uuid":"43539356","full_name":"dandv/discourse-post-process","owner":"dandv","description":"Update/alter/modify/process Discourse posts, e.g. do search and replace, such as after a migration","archived":false,"fork":false,"pushed_at":"2016-02-21T23:58:34.000Z","size":18,"stargazers_count":6,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-26T00:51:17.424Z","etag":null,"topics":["discourse","discourse-api","discourse-posts","node"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dandv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-02T06:48:42.000Z","updated_at":"2018-07-09T13:33:14.000Z","dependencies_parsed_at":"2023-05-06T04:26:27.044Z","dependency_job_id":null,"html_url":"https://github.com/dandv/discourse-post-process","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dandv%2Fdiscourse-post-process","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dandv%2Fdiscourse-post-process/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dandv%2Fdiscourse-post-process/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dandv%2Fdiscourse-post-process/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dandv","download_url":"https://codeload.github.com/dandv/discourse-post-process/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248521210,"owners_count":21118027,"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":["discourse","discourse-api","discourse-posts","node"],"created_at":"2024-10-14T03:46:19.288Z","updated_at":"2025-04-12T05:26:14.671Z","avatar_url":"https://github.com/dandv.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Process Discourse posts\n\nThis Node.js script uses the [Discourse API](https://meta.discourse.org/t/discourse-api-documentation/22706) (via the [discourse-api module](https://www.npmjs.com/package/discourse-api)) to process posts in a Discourse forum. It will:\n\n* apply a set of regexp-based transformations, such as replacing [BBCode](https://en.wikipedia.org/wiki/BBCode) tags with Markdown, e.g. `[hr]` with `------`\n* warn about patterns that may cause rendering problems, such as unconverted `[list]`s or [newlines in nested quotes](https://meta.discourse.org/t/weird-parsing-rule-for-nested-quote-preceded-by-newline/33679).\n\nI've tested the script manually on [400+](http://discourse.quantifiedselfforum.com/zeo) posts migrated from MyBB and am quite satisfied with it.\n\nIt can also delete users from a list of filters, which is useful to clean up spammers coming from a given domain or matching some email address pattern.\n\n## Dependencies\n\nThe script uses ES6 features and thus requires Node v4 or later.\n\n\n## Usage\n\nSimply clone this repo and edit the script to select which transformations and warning checks you'd like to be run.\n\n### Note on topic activity\n\nNote that processing posts will generate (faux) activity in their topic. If the script fixes issues in a bunch of old posts, those will show up at the top of the forum's homepage, even though no \"real\" activity has occurred.\n \nThe recommended way to deal with this is to either,\n \n* process all posts ASAP, at once, before actual users come visit the site\n* process a small number of posts at large intervals, e.g. 5 posts per day, for many days on end.\n\n\n### Fixing quotes\n\nIf you've migrated from MyBB before Discourse accepted [my pull request](https://github.com/discourse/discourse/pull/3802) to fix inline quoting for MyBB imports, [quote lines appear raw](https://meta.discourse.org/t/mybb-import-doesnt-process-on-quoted-posts-pid-and-date/27412). The script can fix these if you've already imported from MyBB (and likely from other forum engines). Here's what you need to do:\n\n1. Obtain an array in the format ``\"\u003cold_id\u003e\": \"post:\u003cpost_num\u003e, topic:\u003ctopic_id\u003e\"`` by running an import script patched to `puts \"\\nXXX \\\"#{quoted_post_id}\\\": \\\"post:#{post.post_number}, topic:#{post.topic_id}\\\"\"` and filtering for lines starting with `XXX`. For example for the MyBB importer, you can add that line after [this line](https://github.com/discourse/discourse/pull/3802/files#diff-45f56f21760a426538b1ae78cdd2ab81R173).\n2. Make sure the array is in a valid JSON file.\n3. Name that file `post_id_mapping.json`. The script will read it.\n\n\n### Fixing colors\n\nBBCode supports `[color]` tags. Discourse does not, but there's a plugin for that called [bbcode-color](https://github.com/discourse/discourse-bbcode-color/). While this script could re-save posts that contain `[color]` tags, it's better to install that plugin and run `rake posts:rebake` to make sure existing posts with color tags are rendered properly. This way, no extra revisions will be created just for interpreting the `[color]` tags.\n\n\n## License\n\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdandv%2Fdiscourse-post-process","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdandv%2Fdiscourse-post-process","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdandv%2Fdiscourse-post-process/lists"}