# When exactly should numeric character references be replaced?

**URL:** <https://talk.commonmark.org/t/when-exactly-should-numeric-character-references-be-replaced/2121>\
**Category:** Spec\
**Created:** [June 3, 2016, 12:15pm UTC](https://talk.commonmark.org/t/when-exactly-should-numeric-character-references-be-replaced/2121 "2016-06-03T12:15:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mgeier](https://cdn.commonmark.org/user_avatar/talk.commonmark.org/mgeier/32/978_2.png) [@mgeier](https://talk.commonmark.org/u/mgeier)\
**Post date:** [June 3, 2016, 12:15pm UTC](https://talk.commonmark.org/t/when-exactly-should-numeric-character-references-be-replaced/2121/1 "2016-06-03T12:15:25Z")

</div>

I’m not sure if I’ve missed that in the spec …

Obviously, numeric character references cannot be replaced before code spans are parsed, but according to the spec any later time would be OK, right?

The problem is: when deciding if a delimiter run is left- or right-flanking, should numeric character references be treated as punctuation (because they start and end with `&` and `;`, respectively), or should they be treated as the Unicode code points they represent?

The reference implementation on [http://try.commonmark.org](http://try.commonmark.org) seems to decide about emphasis before replacing the numeric character references.  
But I think if an author encodes a non-punctuation character, she still wants it to behave like a non-punctuation character w.r.t. emphasis.

For example:

Is the following emphasized or not?

```
i*&#105;i*i

```

Here is a live example: [http://spec.commonmark.org/dingus/?text=%23%20i](http://spec.commonmark.org/dingus/?text=%23%20i)_ii_i%0A%0A%23%20i\*%3Bi_i%0A%0A%23%20i_i%3B_i%0A%0A%23%20i_%26%23105%3Bi_i%0A%0A%23%20i_i%26%23105%3B\*i%0A%0A
