![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
truncate html by text length
using npm
.
npm install -S trunc-html
trunc(html, limit, options?)
Returns the result of truncating the provided html
. A plain-text version is provided as well.
var html = 'the force is <strong>with this one</strong>. some more rubbish';
trunc(html, 30);
// <-
// { html: 'the force is <strong>with this one</strong>. …',
// text: 'the force is with this one. …' }
limit
Maximum amount of text characters allowed. When the limit
is reached, the algorithm will trace back to the last word separator and trim the rest into a …
glyph.
options.ignoreTags
If you'd like to supress certain HTML tags from being output you can provide an array of tags to be excluded, set ignoreTags
to something like ['strong']
.
options.imageAltText
If you'd like to use the alt
attribute for the text portion of the result, instead of dropping images entirely in text flavor, set imageAltText
to true
.
options.sanitizer
Options passed to insane
. Note that these options are overridden by the options provided by trunc-html
, so you can't use transformText
, which trunc-html
reserves for itself.
MIT
FAQs
truncate html by text length
We found that trunc-html demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.