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

feat(filters): add modify_post and modify_feed filters #51

Merged
merged 3 commits into from
Feb 24, 2024

Conversation

shouya
Copy link
Owner

@shouya shouya commented Feb 24, 2024

Fixes #38.

The config syntax looks like:

filters:
  - modify_post: |
        if (feed.title === 'Hacker News') {
          post.title = post.title.replace('Show HN: ', '');
        }
  - modify_feed: feed.title = 'HN';

This implementation is quick and dirty as it merely template the code in modify_post and modify_feed like this:

function modify_post(feed, post) {
  <your code>;
  return post;
}

@shouya shouya merged commit e39c7a9 into master Feb 24, 2024
2 checks passed
@shouya shouya deleted the inline-js-filters branch February 24, 2024 14:48
shouya added a commit that referenced this pull request Feb 25, 2024
Fixes #38.

The config syntax looks like:

``` yaml
filters:
  - modify_post: |
        if (feed.title === 'Hacker News') {
          post.title = post.title.replace('Show HN: ', '');
        }
  - modify_feed: feed.title = 'HN';
```

This implementation is quick and dirty as it merely template the code in
`modify_post` and `modify_feed` like this:

``` javascript
function modify_post(feed, post) {
  <your code>;
  return post;
}
```

---------

Co-authored-by: shouya <shouya@users.noreply.github.com>
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.

A less verbose js filter syntax
1 participant