How to have inline code with GeSHi installed?

How to have inline code with GeSHi installed?

by Ellen Spertus -
Number of replies: 1

I would like to have code displayed both inline and within separate pre-formatted blocks. Before installing GeSHi, I could have inline code by enclosing it within <code>...</code>. For example, I might write "Use an <code>if</code> statement." and it would be displayed as a single sentence, with the word "if" differently colored and in a monoscape font family.

After enabling GeSHi, "<p>Use an <code>if</code> statement.</p>" within an essay question becomes:

<div class="qtext"><p>Use an <div class="php" style="font-family: monospace;"><span style="color: #b1b100;">if</span></div>statement.</p>
(I am not sure why the paragraph terminator is shown in red.  It looks well-balanced to me.)

This is displayed with the "if" on its own line:


Is there a way to have GeSHi enabled and still be able to have code shown inline?  

I am using GeSHi v1.0.8.11-r1 on Moodle 2.9.1+ (Build 20150716) with an unmodified Clean theme.  No other filters are enabled.

Average of ratings: -
In reply to Ellen Spertus

Re: How to have inline code with GeSHi installed?

by Ellen Spertus -

I figured out an answer.  I created a new class "snippet" by adding this custom CSS to the theme:

.snippet {

  font-family: "Courier New", monospace;

  font-weight: bold;

}

I then enclosed inline snippets within: <span class="snippet"> ... </span>