Feature request for the Shopify Community site – allow inline code

New Member
3 0 0

It'd be nice if I could highlight snippets of code or small 'code strings' inline, i.e. not as a block.

 

I tried doing so by editing the HTML of a post (post reply actually) and wrapping small bits of code with HTML code tags, i.e. "<code>" and "</code>" but the post/reply/message text editor rejected my submission and automatically removed the code tags.

0 Likes
Highlighted
New Member
6 0 0

I want this too! It will be really useful for posting tutorials how to edit the theme code so that others can follow easily. Right now I can only make it bold but it's really ugly and distracting. I have seen these inline code blocks in older posts, but I suppose they stopped allowing it. I hope there's a motion for reconsideration. Now there's no button for making inline code in the formatting toolbar. There's no button to choose the font face either also (because at least if you could choose a fixed width font, it would simulate an inline code block).

 

<code>fixed width font</code>

 

Doesn't work.

 

<font face="monospace">fixed width font</font>

 

Will this work? Edit: I tried posting using this reply and it worked! Maybe you can play around with it, adding color, styles or whatever.

0 Likes
Highlighted
New Member
3 0 0

Test – is this formatted like inline code?

That works to set an appropriate font. Annoyingly, the <font> element is obsolete and deprecated so this might stop working eventually.

This didn't work; the editor removes the style attribute as "invalid" HTML:

 

<font face="monospace" style="background-color: #f9f2f4; color: #c7254e; padding: 2px 4px;">this</font>

 

The workaround is a little better than not being able to visually distinguish inline code at all tho!

0 Likes
Highlighted
New Member
6 0 0

Yes, there are a lot of restrictions in the allowed HTML here. And regarding the obsoletion of font tag, I think you cannot use the new method (CSS styling) here so that's the only choice now.

You can use the face, color and size attributes to have limited control over the appearance.

This problem would be fully fixed if the mods would allow code tag to be used. They already have a very good CSS styling for it.

0 Likes