Code Monkey home page Code Monkey logo

rehype-headings-normalize's Introduction

Rehype Headings Normalize

rehype-headings-normalize is a Rehype plugin designed to automatically adjust and normalize the hierarchy of HTML headings in your documents. Crafted with human editors in mind, it corrects common mistakes such as misused or incorrectly leveled headings, ensuring your content is both semantically correct and SEO-friendly. This plugin is perfect for making all headlines hierarchy well-structured and Google happy, without the need for manual adjustments.

NPM Version Badge License Badge

Key Features

  • Heading Level Normalization: Automatically adjusts headings to maintain a logical and SEO-friendly structure.
  • Minimum Level Configuration: Ensures all headings meet a specified minimum level to maintain consistency across your content.
  • Hierarchy Correction: Adjusts child headings to ensure no heading is more than one level deeper than its parent, preventing overly deep nesting and promoting readability.
  • SEO Improvement: By correcting heading structures, it improves the SEO of your documents, making them more favorable to search engines like Google.

Getting Started

Installation

To start using rehype-headings-normalize, first install the package using npm:

npm install rehype-headings-normalize

Configuration

Integrate rehype-headings-normalize into your Rehype setup in your project's configuration file. Here's an example of how to add it to your processing pipeline:

import rehype from 'rehype';
import rehypeHeadingsNormalize from 'rehype-headings-normalize';

rehype()
  .use(rehypeHeadingsNormalize, { minimumLevel: 2 }) // Customize the minimumLevel as needed
  .process(yourHtmlContent)
  .then(file => {
    console.log(String(file));
  });

Options:

  • minimumLevel (optional): Defines the minimum heading level (1 through 6) to ensure all headings are at least of this level. Defaults to 1 if not specified.

Related

Contribution

We welcome contributions from the community to make rehype-headings-normalize even better. Whether it's through bug reports, feature requests, or pull requests, your input is valuable in improving this tool.

License

rehype-headings-normalize is open-sourced software licensed under the MIT License. Feel free to use, modify, and distribute it as part of your projects.

rehype-headings-normalize's People

Contributors

axe312ger avatar

Stargazers

Alexander Eneroth avatar

Watchers

Alexander Eneroth avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.