Display paragraphs items in comma-seperated series I have a series of paragraphs items representing two different types of contributors to a publication: staff (user link) and non-staff (text).  (See How to control the display of a user account connected via entity reference)

According to Paragraphs preprocess paragraphs handles building the render array for its items in the same way as nodes, comments, etc, so maybe my question is much broader, but here's what I'm trying to do:

I want to send up with a basic comma separated list of items:

Person 1

or

Person 1 and Person 3

or

Person 1, Person 2, and Person 3

with links on the items that should be links.  I guess I just am not getting render arrays and the theming functions well enough yet, that I understand how to do it.

The paragraphs preprocess question makes me think maybe I should be overriding the fields_formatter, but what I've been working on up to this point is theme_preprocess_paragraphs_items().  That seems like it should allow me to do what I want, I can see that I could loop through $variables['element']['#items'] or maybe the integer keys of $variables['element'], but how to change those so that they append ', ' or ', and ' or whatever as appropriate (outside of the link on link items is escaping me).  (I do understand how to determine what should be appended, just not where to append it to make drupal output what I want.
append ', ' or ', and ' or whatever as appropriate

You can use CSS to accomplish this
HTML
&lt;div class=&quot;paragraphs-items paragraphs-items-field-doc-editor paragraphs-items-field-doc-editor-full paragraphs-items-full&quot;&gt;
  &lt;div class=&quot;label-inline&quot;&gt;
    Editor:&amp;nbsp;
  &lt;/div&gt;
  &lt;div class=&quot;entity entity-paragraphs-item paragraphs-item-doc-other-contrib-pb&quot; about=&quot;&quot; typeof=&quot;&quot;&gt;
    &lt;div class=&quot;content&quot;&gt;
      &lt;div class=&quot;field-pb-doc-other-fullname&quot;&gt;
        &lt;div class=&quot;field-items&quot;&gt;
          &lt;div class=&quot;field-item even&quot;&gt;
            Person 1
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;entity entity-paragraphs-item paragraphs-item-doc-other-contrib-pb&quot; about=&quot;&quot; typeof=&quot;&quot;&gt;
    &lt;div class=&quot;content&quot;&gt;
      &lt;div class=&quot;field-pb-doc-other-fullname&quot;&gt;
        &lt;div class=&quot;field-items&quot;&gt;
          &lt;div class=&quot;field-item even&quot;&gt;
            Person 2
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;entity entity-paragraphs-item paragraphs-item-doc-other-contrib-pb&quot; about=&quot;&quot; typeof=&quot;&quot;&gt;
    &lt;div class=&quot;content&quot;&gt;
      &lt;div class=&quot;field-pb-doc-other-fullname&quot;&gt;
        &lt;div class=&quot;field-items&quot;&gt;
          &lt;div class=&quot;field-item even&quot;&gt;
            Person 3
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;entity entity-paragraphs-item paragraphs-item-doc-other-contrib-pb&quot; about=&quot;&quot; typeof=&quot;&quot;&gt;
    &lt;div class=&quot;content&quot;&gt;
      &lt;div class=&quot;field-pb-doc-other-fullname&quot;&gt;
        &lt;div class=&quot;field-items&quot;&gt;
          &lt;div class=&quot;field-item even&quot;&gt;
            Person 4
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;div class=&quot;paragraphs-items paragraphs-items-field-doc-author paragraphs-items-field-doc-author-full paragraphs-items-full&quot;&gt;
  &lt;div class=&quot;field-doc-author inline&quot;&gt;
    &lt;div class=&quot;field-label&quot;&gt;
      Author:&amp;nbsp;
    &lt;/div&gt;
    &lt;div class=&quot;field-items&quot;&gt;
      &lt;div class=&quot;field-item even&quot;&gt;
        &lt;div class=&quot;entity entity-paragraphs-item paragraphs-item-doc-iges-contrib-pb&quot; about=&quot;&quot; typeof=&quot;&quot;&gt;
          &lt;div class=&quot;content&quot;&gt;
            &lt;div class=&quot;field-pb-doc-iges-staff&quot;&gt;
              &lt;div class=&quot;field-items&quot;&gt;
                &lt;div class=&quot;field-item even&quot;&gt;
                  &lt;a href=&quot;/person4&quot;&gt;Person 4&lt;/a&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;div class=&quot;paragraphs-items paragraphs-items-field-doc-editor paragraphs-items-field-doc-editor-full paragraphs-items-full&quot;&gt;
  &lt;div class=&quot;label-inline&quot;&gt;
    Translator:&amp;nbsp;
  &lt;/div&gt;
  &lt;div class=&quot;entity entity-paragraphs-item paragraphs-item-doc-other-contrib-pb&quot; about=&quot;&quot; typeof=&quot;&quot;&gt;
    &lt;div class=&quot;content&quot;&gt;
      &lt;div class=&quot;field-pb-doc-other-fullname&quot;&gt;
        &lt;div class=&quot;field-items&quot;&gt;
          &lt;div class=&quot;field-item even&quot;&gt;
            &lt;a href=&quot;/person5&quot;&gt;Person 5&lt;/a&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;entity entity-paragraphs-item paragraphs-item-doc-other-contrib-pb&quot; about=&quot;&quot; typeof=&quot;&quot;&gt;
    &lt;div class=&quot;content&quot;&gt;
      &lt;div class=&quot;field-pb-doc-other-fullname&quot;&gt;
        &lt;div class=&quot;field-items&quot;&gt;
          &lt;div class=&quot;field-item even&quot;&gt;
            &lt;a href=&quot;/person6&quot;&gt;Person 6&lt;/a&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

CSS
.paragraphs-items { /* start each field on a new line*/
    clear: left;
}

.paragraphs-items div { /* eliminate the blocky results of div hell (eliminate some extra spacing in the process)*/
    float: left;
}

.paragraphs-items .entity-paragraphs-item .content:after { /* default to putting commas after every value … */
    content: &quot;, &quot;;
}

.paragraphs-items .entity-paragraphs-item:last-child .content:after { /* … except the last one */
    content: &quot;&quot;;
}

.paragraphs-items .entity-paragraphs-item:nth-last-child(2) .content:after { /* The last two items in the series should be separated by a &quot;, and &quot; … */
    content: &quot;, and &quot;;
}

.paragraphs-items .entity-paragraphs-item:nth-last-child(2):nth-child(2) .content:after { /* … unless there are only two items, in which case it should be &quot; and &quot; */
    content: &quot; and &quot;;
}
      

EXAMPLE DEMO
Note in content: &quot;, &quot; since it won't pick up the empty space (by pressing the space bar) I used the ALT+0160 trick to make the empty space.