pimd icon indicating copy to clipboard operation
pimd copied to clipboard

Showmore plugin: Allow negative numbers

Open hagenburger opened this issue 6 years ago • 0 comments

Existing functionality

Video preview of Showmore plugin

Detailed documentation: https://github.com/hagenburger/pimd/tree/master/plugins/showmore#readme

New feature

To allow more easy counting, allow negative numbers:

```html +showmore=2..-2
<ul>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
</ul>
```

Should have the same result as:

```html +showmore=2..11
<ul>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
</ul>
```

And should look like:

<ul>
  ···
</ul>

The counting works like:

 1 -12 <ul>
 2 -11   <li></li>
 3 -10   <li></li>
 4  -9   <li></li>
 5  -8   <li></li>
 6  -7   <li></li>
 7  -6   <li></li>
 8  -5   <li></li>
 9  -4   <li></li>
10  -3   <li></li>
11  -2   <li></li>
12  -1 </ul>

Both numbers of the range can be negative:

```html +showmore=-3..-1
<ul>
  <li></li>
  <li></li>
</ul>
```

Should result in:

<ul>
  ···

hagenburger avatar Oct 01 '18 22:10 hagenburger