quarto-dev / quarto-dev/quarto-cli
Project specify port for localhost
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 6k
- Forks
- 458
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 41
Description
Bug description
When I render a Quarto qmd file "--to clean-revealjs" or "--to html" in VSCode via the preview button or CTRL-SHIFT-K Quarto uses a random port for the localhost. The Quarto Project Options and the Quarto Creating a Website states one can insert:
project:
preview:
port: 4200
However, despite having inserted this option into the project's _quarto.yml a random port number is still used. Other options in the _quarto.yml file are being applied, so I know the manifest is found and read. Some others have reported the same experience:
https://stackoverflow.com/questions/75715950/quarto-project-specify-port-for-localhost
Also tried setting the browser option to true and false which also had no effect.
project:
preview:
port: 4200
browser: true
When the preview is re-rendered automatically after a change, then having a different port number is disruptive to the development workflow experience when showing the preview in both the VSCode preview and a browser.
Steps to reproduce
- Add to the project directory a _quarto.yml file that contains:
project:
preview:
port: 4200
-
Open a .qmd file in VSCode with the Quarto extension.
-
Preview the .qmd document with CTRL-SHIFT-P | Quarto Preview Format... | format: clean-revealjs or format: html
Observe the quarto command in the terminal is missing the --port option.
No matter the port number specified, Quarto continues to choose a random port number instead of accepting the project.preview.port value in _quarto.yml.
Expected behavior
Terminal output for the preview command should say:
quarto preview [...qmd file...] --no-browser --no-watch-inputs --port 4200
Actual behavior
Terminal output for the preview command is missing the --port option, despite it being in the _quarto.yml file.
quarto preview [...qmd file...] --no-browser --no-watch-inputs
For this image, this was the command (at the top of the terminal scroll not seen in image below):
quarto preview c:/dev/trinity-courses/110-essentials-of-computing-S24/lectures/lecture-7.1.qmd --to clean-revealjs --no-browser --no-watch-inputs
Your environment
- IDE: VSCode 1.87
- Quarto plugin: v1.111.0
- Windows: 11
Quarto check output
Quarto 1.4.550
[>] Checking versions of quarto binary dependencies...
Pandoc version 3.1.11: OK
Dart Sass version 1.69.5: OK
Deno version 1.37.2: OK
[>] Checking versions of quarto dependencies......OK
[>] Checking Quarto installation......OK
Version: 1.4.550
Path: C:\Users\jonat\AppData\Local\Programs\Quarto\bin
CodePage: 1252
[>] Checking tools....................OK
TinyTeX: v2023.10
Chromium: 869685
[>] Checking LaTeX....................OK
Using: TinyTex
Path: C:\Users\jonat\AppData\Roaming\TinyTeX\bin\windows\
Version: 2023
[>] Checking basic markdown render....OK
[>] Checking Python 3 installation....OK
Version: 3.12.2
Path: C:/Users/jonat/AppData/Local/Programs/Python/Python312/python.exe
Jupyter: 5.7.1
Kernels: python3
[>] Checking Jupyter engine render....OK
[>] Checking R installation...........OK
Version: 4.2.3
Path: C:/PROGRA~1/R/R-42~1.3
LibPaths:
- C:/Program Files/R/R-4.2.3/library
knitr: 1.42
rmarkdown: 2.21
[>] Checking Knitr engine render......OK
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the VSCode preview using a project _quarto.yml containing project.preview.port and inspect the generated quarto preview command. Start from the command invocation described in the issue; done means the command includes --port 4200 and the preview uses that stable port for HTML or clean-revealjs output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100