quarto-web icon indicating copy to clipboard operation
quarto-web copied to clipboard

docs: make bracketed inline code the default syntax

Open mcanouil opened this issue 1 year ago • 6 comments

The commits in this pull request update the syntax for inline code in the documentation. The changes include using {r} primarily instead of `r` to denote inline R code. These updates improve consistency in the documentation.

Related to quarto-dev/quarto-cli#10805

mcanouil avatar Sep 16 '24 08:09 mcanouil

Thanks.

Why do you think using {r} is more consistent ?

It has been asked already in

  • https://github.com/quarto-dev/quarto-cli/issues/10748

and I agreed with @cscheid on his answer

the previous syntax is historically very popular and this is an intentional choice.

Though looking into docs and its history, it seems your change in a follow up on

  • https://github.com/quarto-dev/quarto-web/pull/953

where it seems to have been decided that using `{r}` is the prefered syntax, and the PR missed some place to change the syntax.

As reported in https://github.com/quarto-dev/quarto-cli/issues/10805, the new syntax has a change in default behavior regarding string output compared to knitr and R Markdown context, a difference that could be surprising to existing R Markdown user. I did not know we wanted to push using `{r} instead of `r

I'll defer to @cwickham and @mine-cetinkaya-rundel for their advice on which one to document first for R documents. Especially as I guess a choice has been made for the Quarto book.

If we really go to new syntax as primary one to use, we should probably add an example in Get Started about outputting raw markdown without escaping.

cderv avatar Sep 16 '24 14:09 cderv

As reported in https://github.com/quarto-dev/quarto-cli/issues/10805, the new syntax has a change in default behavior regarding string output compared to knitr and R Markdown context, a difference that could be surprising to existing R Markdown user. I did not know we wanted to push using {r} instead of r

That is the question indeed as I really thought the brackets syntax was the one to advertise since the documentation states in several places to use brackets and that the syntax without is still supported.

Regarding the string/markdown, I think there is an issue or discussion about harmonising across engines behaviours.

mcanouil avatar Sep 16 '24 14:09 mcanouil

Regarding the string/markdown, I think there is an issue or discussion about harmonising across engines behaviours.

Not sure to see which one is it. I am interesting to look at it if you find it;

With {lang} syntax for inline both Jupyter and Knitr engine behave the same, which is different for historical default `r behavior.

Knitr

---
format: html
engine: knitr
---

This will be bold `r "**hello**"`

This won't be bold `{r} "**hello**"`

But now this will `{r} I("**hello**")`

image

Jupyter

---
format: html
engine: jupyter
---

```{python}
from IPython.display import Markdown 
```


This won't be bold `{python} "**hello**"`

But now this will `{python} Markdown("**hello**")`

image

cderv avatar Sep 16 '24 14:09 cderv

I agree with @cderv's assessment here. I'm willing to eventually replace the "legacy" knitr syntax in our docs, but we need have a broader discussion about it that explains the situation to both knitr and jupyter users. This is not a change I want to make lightly.

cscheid avatar Sep 16 '24 17:09 cscheid

Unfortunately, the change already took place in almost all corner of the documentation. This PR is really a follow up as Christophe highlighted.

mcanouil avatar Sep 16 '24 17:09 mcanouil

but we need have a broader discussion about it that explains the situation to both knitr and jupyter users. This is not a change I want to make lightly.

Added as Team discussion item for next meeting.

cderv avatar Sep 16 '24 18:09 cderv

I'm picking this up after our team discussion on Sep 18.

  • I've kept the changes to docs/get-started/computations/rstudio.qmd: we agreed we should be consistent and use {r}
  • I reverted the changes to docs/manuscripts/authoring/_inline-computations in favor of https://github.com/quarto-dev/quarto-web/pull/1400/files
  • I made some wording changes to docs/visual-editor/technical.qmd and made sure to link back to the primary Inline Code page.

cwickham avatar Oct 22 '24 21:10 cwickham

/deploy-preview

cwickham avatar Oct 22 '24 21:10 cwickham

🚀 Deployed on https://deploy-preview-1334.quarto.org

github-actions[bot] avatar Oct 22 '24 21:10 github-actions[bot]

Backport failed for prerelease, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin prerelease
git worktree add -d .worktree/sync-1334-to-prerelease origin/prerelease
cd .worktree/sync-1334-to-prerelease
git switch --create sync-1334-to-prerelease
git cherry-pick -x 231e8f22088fcb81ef66e6d5a3b8c9cf5ddd276b 914386974aef0b474abd62c00afa19eea8c71efa 45d6d836fca6dcf9eba7cd8fdecf19a79426ca44

github-actions[bot] avatar Oct 23 '24 22:10 github-actions[bot]

@cwickham I cherry picked the commit in pre-release: c776e84a0ef0f521d3e93c9fa65b9f7d5320907d So changes are there now.

cderv avatar Oct 24 '24 08:10 cderv