Press "Enter" to skip to content

How to Converts Bodies/Long Paragraph of Text Into Paragraphs | Paragraphier

A Jquery-based script that converts large strings from text into paragraphs. Paragraphier is a jQuery applet for writers that converts/splits a long paragraph into short paragraphs for easy reading.

random paragraph copy and paste, long paragraph example, html paragraph spacing, html space between words on same line, jquery plugin to highlight word within content

How to make use of it:

1. Create a Textarea component to simply accept long paragraphs.

<textarea id="text" rows="5"></textarea>

2. Create a choose component from which you’ll choose the number of sentences per paragraph.

<select id="sentences">
  <option value="2">2</option>
  <option value="4">4</option>
  <option value="6">6</option>

3. Load the required jQuery JavaScript library on the finish of the doc.

<script src="/path/to/cdn/jquery.slim.min.js"></script>

4. The most important JavaScript (jQuery script) to allow the lengthy paragraph converter.

function paragrphier(){

  let text = $('#text').val();
  let sentences = $("#sentences option:selected" ).val();

  const expectedSentenceCount = sentences;
  let overallCount = 0;
  let sentenceCount = 0;
  let previousIndex = 0;

  const totalFullStops = (text.match(/,/g) || []).length;

  $('#sentenceCount').html('Total Number Sentences: '+ totalFullStops);

  let newText = '';

  for(let i = 0; i < text.length; i++){
    let value = text.charAt(i);

    if(sentenceCount == expectedSentenceCount){
      newText += text.substring(previousIndex, i) + '</br></br>';
      previousIndex = i;
      sentenceCount = 0;

      if((totalFullStops - overallCount) < expectedSentenceCount ){
      newText += text.substring(previousIndex, (text.length)) + '</br></br>';

    if(value === '.'){
      sentenceCount += 1;
      overallCount += 1;


5. Create a convert button on the web page.

<button onclick="paragrphier()">Paragraphy</button>

6. Create an empty container to hold the output.

<div id="outputText">

long paragraph to short paragraph converter, Paragraphier Plugin/Github

See Demo And Download

Official Website(Plaganomics): Click Here

This superior jQuery/javascript plugin is developed by Plaganomics. For extra advanced usage, please go to the official website.

Be First to Comment

    Leave a Reply

    Your email address will not be published.