• Home
  • Categories
  • Recent
  • Popular
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development
Skins
  • Light
  • Default
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Quartz
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Slate
  • Solar
  • Superhero
  • Vapor
Collapse

Community

denism7D

denism7

@denism7
About
Posts
5
Topics
1
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

    Convert images on upload to webp?
  • denism7D denism7

    @jminer I have my own homebrew plugin for this purpose. But it's actually used to reduce bandwidth and keeps original image untouched along with webp-version.

    You can replace your images with webp completely, but you'll have to keep your code up-to-date with new nodebb versions.


  • Need request headers inside
  • denism7D denism7

    @pitaj said in Need request headers inside:

    markdown-it-picture

    Is it possible to use markdown plugins without building custom version of nodebb?


  • Need request headers inside
  • denism7D denism7

    @pitaj it's all about efficiency. I have two options. The first is replacing the uri before markdown parsing. The second one is working with resulting HTML when I need to replace the whole a>img subtree with a>picture>[source, source, img] keeping all its attributes, CSS-classes and so on.

    Keep in mind, we are inside parse.post hook. It basically runs every time each post is rendered (leaving caching aside). I believe, building of DOM subtree will be too wasteful in terms of CPU time. Regex for HTML-code will be more complex and less reliable as well. It can be done easily with client-side script, but it's a bit undesirable to me.

    Any suggestions for altering the HTML are welcome, though.


  • Need request headers inside
  • denism7D denism7

    @pitaj since there are no hooks inside of markdown parser itself, I haven't found an easy and efficient way to replace a single img with a picture. So I just add webp copy to every uploaded image. Right before parsing I replace image link using regex, but I shouldn't do that if it's unsupported by client.

    So I guess I need to store WebP-support flag somewhere when request is accessible to use it later in the parse hook. That's why I'm asking an advice.


  • Need request headers inside
  • denism7D denism7

    Hi there,

    I'm creating a plugin for WebP image handling. Need to check server-side if user's browser supports it.

    I guess I can't access HTTP request params inside filter:parse.post.

    Any ideas on exact hook to get this data and store it somehow?

  • Login

  • Don't have an account? Register

  • Login or register to search.
Powered by NodeBB Contributors
  • First post
    Last post
0
  • Home
  • Categories
  • Recent
  • Popular
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development
  • Login

  • Don't have an account? Register

  • Login or register to search.