reveal.js icon indicating copy to clipboard operation
reveal.js copied to clipboard

Italic Markdown messes up fragments

Open dploeger opened this issue 8 years ago • 19 comments

(Originally reported as dploeger/jekyll-revealjs#8)

Italic conflicts with fragments:

For example, if in one slide I have:

Item one.  <!-- .element: class="fragment" data-fragment-index="1" -->

Item *two*.  <!-- .element: class="fragment" data-fragment-index="2" -->

the word "Item" of element "Item two" will not respect the order of appearance, and will be shown regardless.

dploeger avatar Mar 16 '17 20:03 dploeger

This is still true, and applies to any markup within a fragment. For example, bold is a problem as well.

robinparmar avatar Jun 17 '17 00:06 robinparmar

Test case: http://jsbin.com/sihikodopi/edit?html,output

jcfranco avatar Jul 06 '17 23:07 jcfranco

Any thoughts on this?

ryan-ju avatar Jul 28 '17 23:07 ryan-ju

I've found a workaround to this problem, to help until we find an actual fix.

Placing the HTML comments like this conflicts with the Markdown italics, bold, or code tags:

Item one.  <!-- .element: class="fragment" data-fragment-index="1" -->

Item *two*.  <!-- .element: class="fragment" data-fragment-index="2" -->

However, placing the HTML comments like this seems to work around the problem:

<!-- .element: class="fragment" data-fragment-index="1" --> Item one.

<!-- .element: class="fragment" data-fragment-index="2" --> Item *two*.

The same workaround works with lists:

- <!-- .element: class="fragment" data-fragment-index="1" --> Item one.

- <!-- .element: class="fragment" data-fragment-index="2" --> Item *two*.

I hope this helps people who need it.

busser avatar Aug 02 '17 10:08 busser

I came with the intention to raise an issue about it but found this one from a year ago that still holds.

The workaround suggested by @surgicalbanana worked for me, maybe it'd be nice to document this somewhere?

gvolpe avatar Jun 07 '18 04:06 gvolpe

thanks @busser that helped.

seriousManual avatar Oct 11 '18 17:10 seriousManual

Thanks @busser for the solution. But there should be some better ways to solve it?

xarthurx avatar Apr 28 '19 17:04 xarthurx

The workaround does not work for me. Perhaps it broke in the latest update?

jakupmichaelsen avatar Sep 02 '19 07:09 jakupmichaelsen

Granted, I'm using reveal-md, but I found another solution that works for me: wrapping the fragments in <div> tags:

## Testing markdown fragments

<div>

<!-- .element: class="fragment" --> 
Test **1** Test
</div>

<div>

<!-- .element: class="fragment"  -->
Test **2** Test
</div>

Note that two line breaks are required after the <div> tag - otherwise it only renders as text.

It works with lists as well:

Testing markdown fragments

<div>

<!-- .element: class="fragment" --> 
- Test **1** Test
</div>

<div>

<!-- .element: class="fragment"  -->
- Test **2** Test
</div>

Renders as: gif

jakupmichaelsen avatar Sep 04 '19 19:09 jakupmichaelsen

@jakupmichaelsen Interesting find! This works for me as well, but is not really usable for lists: Each list item will generate a new list, so there's no common indentation.

Would really love a generic solution for this problem...

kremerd avatar Oct 10 '19 15:10 kremerd

this workaround works for lists:

- <!-- .element: class="fragment" --> Item one.
- <!-- .element: class="fragment" --> Item <i>two</i>.

Still a workaround, but usable.

alpianon avatar Feb 23 '20 18:02 alpianon

just discovered that also this workaround works:

- <!-- .element: class="fragment" --> This is item one.
- This <!-- .element: class="fragment" --> is item *two*.

alpianon avatar Feb 23 '20 18:02 alpianon

and this is a hacky solution if you have bold or italic at the beginning of the line:

- &shy;<!-- .element: class="fragment" --> **This** is item one.
- This <!-- .element: class="fragment" --> is item *two*.

alpianon avatar Feb 23 '20 20:02 alpianon

+1 Would love to see this fixed.

christofs avatar Sep 07 '20 08:09 christofs

This is still not fixed today.

Also, the workarounds above don't work for me, because placing fragment before list item text doesn't render formatting in line:

- <!-- .element: class="fragment" --> line 1
- <!-- .element: class="fragment" --> **line 2** with some `inline code`

☝️ Doesn't render formatting in the 2nd line

miluoshi avatar Feb 10 '22 07:02 miluoshi

As @alpianon said, just add &shy;<!-- .element: class="fragment" --> before your item content (when they contains links or anything non text).

- &shy;<!-- .element: class="fragment" --> **This** is item one.
- &shy;<!-- .element: class="fragment" --> This is [item](https://...) *two*.

Still, a proper fix for this would be great!

ia3andy avatar Aug 19 '22 15:08 ia3andy

Unfortunately this issue/bug still alives. For workaround see the answer from: @ia3andy .

Here is the working example:

- &shy;<!-- .element: class="fragment" style="font-size:1.2rem" --> <span style="color:orange">list-colored-item</span>  with **bold** text

mehmetozanguven avatar Jul 21 '23 22:07 mehmetozanguven

Still true with 4.6.0

darkmattercoder avatar Sep 27 '23 16:09 darkmattercoder