One more trick building on what Stuart suggested. :replacements.U\+2603: ☃
[source,javascript] [presubs="none"] [postsubs="replacements"] ---- var str = 'U+2603'; ---- (I tried to use \u2603 but the source highlighter grabs the \u). -Dan On Wed, Nov 6, 2013 at 1:18 PM, Dan Allen <[email protected]> wrote: > > > > On Wed, Nov 6, 2013 at 12:41 PM, Stuart Rackham <[email protected]>wrote: > >> On 07/11/13 00:24, Dan Allen wrote: >> > Hey Axel & Stuart, >> > >> > Another way is to enable the attributes subs on the listing block. >> > >> > By default, a listing block has the subs specialcharacters and callouts. >> > You can modify this set as follows: >> > >> > [source,javascript] >> > [subs="specialcharacters,attributes,callouts"] >> > ---- >> > ... = '{cow}'; >> > ---- >> > >> > Another option is to enable macros and use a pass:[] macro to allow the >> > char reference to go through untouched. However, I've observed conflicts >> > between escaped placeholders and syntax highlighting. >> >> You need to use postsubs instead of subs to ensure it's done after the >> highlighter has executed (subs is an alias for presubs), > > > Ah, right. > > > >> but that still >> won't fix it because Attribute Entry values are substituted for special >> characters (see 'Attribute Entries' >> (http://asciidoc.org/userguide.html#X18)). >> >> Neither will putting pass:[🐄] in the listing because, again, the >> highlighter will escape the ampersand. >> >> The only way I can think of to ensure the ampersand is not escaped is to >> use a replacement e.g. >> >> :replacements.COW: 🐄 >> >> [source,javascript] >> [presubs="none"] >> [postsubs="replacements"] >> ---- >> var str = 'COW'; >> ---- >> > > There's another way very similar to this approach: > > :cow: pass:[] > > [source,javascript] > [postsubs="attributes"] > ---- > var str = '{cow}'; > ---- > > That's probably the safest way since it doesn't add global word > replacements. > > (Attributes truly are life savers). > > -Dan > > -- > Dan Allen | http://google.com/profiles/dan.j.allen > -- Dan Allen | http://google.com/profiles/dan.j.allen -- You received this message because you are subscribed to the Google Groups "asciidoc" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/asciidoc. For more options, visit https://groups.google.com/groups/opt_out.
