Quotes in content

Hi. It seems like single and double quotes in content are being converted to Unicode. We’re saving content in Markdown in MySQL and then displaying as HTML later. How do we keep single and double quotes, and probably other content too, just as the characters they were typed in as? When displayed back, they’re just turning to question marks at the moment.

Do I have to write and install an InputRule for this? I didn’t set ProseMirror up and I’m a little confused about this.

Thanks,

  • Andrew.

This is happening because your ProseMirror is currently using some of the already provided input rules. Looking at the “example-setup” you’ll see these inputRules being added. What you’ll want to do is make sure the following input rules are not added:

  • openDoubleQuote
  • closeDoubleQuote
  • openSingleQuote
  • closeSingleQuote
  • smartQuotes
1 Like

Thank you very much for your response. I’ve looked at my example-setup, and there are no input rules added. Here’s what I had:

  this.pm = new ProseMirror({
    place: place,
    doc: defaultMarkdownParser.parse(content),
    plugins: [
      exampleSetup.config(
        {
          menuBar: true,
          tooltipMenu: false
        }
      )
    ]
  })

I’ve spent hours reading through the source code and the documentation, looking at all the examples, and I’ve tried every permutation of adding in the input rules that I can possibly think of. Nothing’s worked.

This isn’t my forté, and I understand it’s an open source product and I very much appreciate all the work that everyone has put into ProseMirror. It’s odd and frustrating though that I can’t find even one example of actually using input rules anywhere. I’d really appreciate a bit more help here if anyone’s willing to provide it. Thanks.

You are using the exampleSetup. If you look at example-setup/index.js or whatever file it is in the version you’re using, you will see the input rules being applied. Copy this file and customize it.

Here and here you have to look at the example setup, for the input rules.