![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
hexo-html-truncate
Advanced tools
-- A Hexo plugin to truncate html by only counting word filtering out html tags
npm install hexo-html-truncate --save
/**
* truncate html
* @method truncate(html, [length], [options])
* @param {String|CheerioStatic} html html string to truncate, or existing cheerio instance(aka cheerio $)
* @param {Object|number} length how many letters(words if `byWords` is true) you want reserve
* @param {Object|null} options
* @param {Boolean} [options.stripTags] remove all tags, default false
* @param {String} [options.ellipsis] ellipsis sign, default '...'
* @param {Boolean} [options.decodeEntities] decode html entities(e.g. convert `&` to `&`) before
* counting length, default false
* @param {String|Array} [options.excludes] elements' selector you want ignore
* @param {Number} [options.length] how many letters(words if `byWords` is true)
* you want reserve
* @param {Boolean} [options.byWords] if true, length means how many words to reserve
* @param {Boolean|Number} [options.reserveLastWord] how to deal with when truncate in the middle of a word
* 1. by default, just cut at that position.
* 2. set it to true, with max exceed 10 letters can exceed to reserver the last word
* 3. set it to a positive number decide how many letters can exceed to reserve the last word
* 4. set it to negetive number to remove the last word if cut in the middle.
* @param {Boolean} [options.trimTheOnlyWord] whether to trim the only word when `reserveLastWord` < 0
* if reserveLastWord set to negetive number, and there is only one word in the html string,
* when trimTheOnlyWord set to true, the extra letters will be cutted if word's length longer
* than `length`.
* see issue #23 for more details
* @param {Boolean} [options.keepWhitespaces] keep whitespaces, by default continuous
* spaces will be replaced with one space
* set it true to reserve them, and continuous spaces will count as one
* @return {String}
*/
{
byWords: false,
stripTags: false,
ellipsis: '...',
decodeEntities: false,
keepWhitespaces: false,
excludes: '',
reserveLastWord: false,
keepWhitespaces: false
}
// content: post html content
// length: truncate word length
// options: check out the API part of this
// document for avaliable options
htmlTruncate(content, length, options);
<div class="content">
{{ htmlTruncate(post.content, 100, {
ellipsis: '...',
excludes: ['img'],
keepWhitespaces: true,
reserveLastWord: true
}) }}
</div>
<div class="content">
<%- htmlTruncate(post.content, 100, {
ellipsis: '...',
excludes: ['img'],
keepWhitespaces: true,
reserveLastWord: true
}) %>
</div>
span.post-count= htmlTruncate(post.content, 100, {
ellipsis: '...',
excludes: ['img'],
keepWhitespaces: true,
reserveLastWord: true
})
MIT
Base on the package mehwww/vue-sticky-directive, this package just compiled the package into a hexo plugin for easier use in hexo.
FAQs
hexo-html-truncate
The npm package hexo-html-truncate receives a total of 0 weekly downloads. As such, hexo-html-truncate popularity was classified as not popular.
We found that hexo-html-truncate 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
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
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.