Problem with apostrophe in visual mode

I am typing some text in French using both R Markdown and Quarto documents. Both have the same behavior.

I typed the following in the Source mode of RStudio:


Note that the two lines are identical except for the apostrophe (the second one is the appropriate for text in French). When I switch to the visual mode, both lines are the same and I lost the appropriate French apostrophe.

Any clue on how to deal with this?

Many thanks!


Just curious, how do you insert the French apostrophe with you keyboard ?
I am French too, and never payed much attention to that.

What do you get in your rendered document ? Visual editor is for Markdown sources, and it will auto correct to markdown syntax. It is possible the apostrophe will render ok, especially in a document with lang: fr

Anyway, this would be an issue with RStudio IDE and visual editor and not directly R Markdown. I am moving the post in the right place.

Merci pour votre réponse.

The French apostrophe can be directly inserted on macOS by typing option-shift-è on a CSA French-Canada keyboard or option-shift-4 on a French keyboard.

I am also coming to the conclusion that RStudio IDE rather than R Markdown has an issue.

Here are the results after rendering the following simple document, both in R Markdown and Quarto:

## Test avec l'apostrophe

Voici comment est rendu les apostrophes:

-   En tapant l'apostrophe droite

-   En tapant l’apostrophe courbe.
  • results are all the same (rendering R Markdown and Quarto, to HTML and PDF:

My conclusion:

  • Rendering takes care of apostrophes given the expected results
  • The RStudio IDE removes the French apostrophe the switching from source to visual, and back to source mode.
  • When typing the French apostrophe in visual mode, and switching to source mode, the apostrophe is now \' .
  • It's a behavior that is different from other apps that use Markdown, at least on macOS.

then you should open an issue if none exists already in the RStudio IDE github repo. This is possibly an issue with the visual editor

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.