Preview Plugin
-
If I wanted a function that strips certain words from the
.content p
(post) fields (removes them at DB level), what would be the best way to achieve this? I am pulling an RSS feed that contains text I'd like to remove (this is a private site I am running designed to work as a security feed), and I'd rather have the URL pretty formatted, but of course, it will not render because of the other text on the same line.Any ideas?
Thanks
-
@phenomlab hmm...
On the way in, you'd be hooking into
filter:post.create
, possibly. At that pointcontent
from an RSS feed would be html.I'll tell you how I'd approach it, which may be the wrong approach
npm i cheerio
- Parse incoming html and find all the anchors
- Do your preview generation
- Replace content using cheerio selectors.
Funny enough, this is exactly how
link-preview
works -
@julian said in Preview Plugin:
Funny enough, this is exactly how link-preview works
Yes,
OGProxy
works the same way My thoughts would be around a regex - something likenodebb-plugin-beep
but with the ability to completely remove words rather than just say "[censored]" - I could fork that plugin and write in that functionality actually...Hmmm....
-
@phenomlab I'm sure you've seen this?
RegEx match open tags except XHTML self-contained tags
I need to match all of these opening tags: <p> <a href="foo"> But not self-closing tags: <br /> <hr class="foo" /> I came up with this and wanted to make
Stack Overflow (stackoverflow.com)
Won't stop people like us from trying though hahaha
RegEx match open tags except XHTML self-contained tags
I need to match all of these opening tags: <p> <a href="foo"> But not self-closing tags: <br /> <hr class="foo" /> I came up with this and wanted to make
Stack Overflow (stackoverflow.com)
-
@julian Yes, thanks. Actually, I think I narrowed down the issue. There is a fork of
nodebb-plugin-rss
that I am using callednodebb-plugin-rss-brad
- I think the changes here are that it renders other HTML (description - like v1.3 of the official NodeBB version did), so I went for that.I think it is that plugin that adds "Via: " as it is doing it on all links, and not on my other site which uses the stock NodeBB version.
Let me confirm, and if so, this can be closed.
-
a github link in this post as:
GitHub - Licoy/wordpress-theme-puock: :art: 一款基于WordPress开发的高颜值的自适应主题,支持白天与黑夜模式/无刷新加载/第三方登录等众多功能 | A high-value adaptive theme based on WordPress, supports light and dark modes, no refresh loading, etc.
:art: 一款基于WordPress开发的高颜值的自适应主题,支持白天与黑夜模式/无刷新加载/第三方登录等众多功能 | A high-value adaptive theme based on WordPress, supports light and dark modes, no refresh loading, etc. - Licoy/wordpress-theme-puock
GitHub (github.com)
in my site :