Running input rules in a code block?

I want to run inputRules within a code block. Is this not possible? It seems that prosemirror explicitly shortcuts the inputRules code when it’s within a spec marked as code…

for more context, line 94 of the run() function of index.js of prosemirror-inputrules short circuits for spec’s labeled as code. Everything works fine for me if I get rid of this line. Unless there’s some other workaround, can another flag be added to the spec explicitly enabling inputRules for code?

**if ($from.parent.type.spec.code)**
   return false;
1 Like

Indeed it does. A pull request that adds a per-rule inCode option to turn that off would be welcome.

Okay, I just made a pull request - my first one, so let me know how I did. Thanks.

How do we feel about this applying to code marks as well? Typing inside of a code mark it doesn’t make sense for any of the predefined rules to apply such as emdash, smart quotes etc…

You’ll have to check this in your input rule. Changing the behavior at this point would be a breaking change (and not appropriate in all situations).

Probably the right thing, I think the chosen API on this PR does make it possible though – you could have an additional value for inCode that would be non-breaking, such as “never”, “none”