diff --git a/news/changelog-1.7.md b/news/changelog-1.7.md index 2d11fa630cc..e193ac3b9ea 100644 --- a/news/changelog-1.7.md +++ b/news/changelog-1.7.md @@ -17,3 +17,7 @@ All changes included in 1.7: This also provides a new public function `quarto.utils.is_empty_node` that allows to check whether a node is empty, i.e., whether it's an empty list, has no child nodes, and contains no text. + +## Other Fixes and Improvements + +- ([#11643](https://github.com/quarto-dev/quarto-cli/issues/11643)): Improve highlighting of nested code block inside markdown code block, i.e. using ` ```{{python}} ` or ` ```python ` inside ` ````markdown` fenced code block. diff --git a/src/resources/pandoc/syntax-definitions/markdown.xml b/src/resources/pandoc/syntax-definitions/markdown.xml index 5da3a9bce8e..3e077a70556 100644 --- a/src/resources/pandoc/syntax-definitions/markdown.xml +++ b/src/resources/pandoc/syntax-definitions/markdown.xml @@ -22,6 +22,11 @@ Example: **bold text and _italic and bold text_** __bold and ~~strikeout and bold~~__ --> + @@ -72,6 +77,10 @@ + + + + @@ -88,15 +97,9 @@ - - - - - - ]> - + @@ -143,9 +146,12 @@ + + + @@ -154,6 +160,16 @@ + + + + + + + + + + @@ -213,6 +229,7 @@ + @@ -232,6 +249,7 @@ + @@ -260,6 +278,8 @@ + + @@ -290,13 +310,14 @@ to check the indentation of the text and determine if the content of the list ends. --> - + + @@ -309,6 +330,12 @@ + + + + + + @@ -319,40 +346,41 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -390,6 +418,10 @@ + + + + @@ -426,6 +458,10 @@ + + + + @@ -462,7 +498,7 @@ - + @@ -511,6 +547,8 @@ + + @@ -529,6 +567,7 @@ + @@ -537,7 +576,7 @@ - + @@ -604,302 +643,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -907,6 +650,7 @@ + @@ -922,6 +666,7 @@ + @@ -930,11 +675,14 @@ + + + diff --git a/tests/docs/smoke-all/2024/09/24/issue-10821-b.qmd b/tests/docs/smoke-all/2024/09/24/issue-10821-b.qmd index 434e98a14c0..305b7498552 100644 --- a/tests/docs/smoke-all/2024/09/24/issue-10821-b.qmd +++ b/tests/docs/smoke-all/2024/09/24/issue-10821-b.qmd @@ -5,7 +5,7 @@ _quarto: tests: html: ensureFileRegexMatches: - - ['#\| fig-cap: ''This figure will have ''''echo: fenced'''' in its caption.'''] + - ['#\| fig-cap: ''This figure will have ''''echo: fenced'''' in its caption.'''] - [] # - ['fig-cap'] --- diff --git a/tests/docs/smoke-all/2024/09/24/issue-10821.qmd b/tests/docs/smoke-all/2024/09/24/issue-10821.qmd index 5fb8830a288..f1d9eb3a9fd 100644 --- a/tests/docs/smoke-all/2024/09/24/issue-10821.qmd +++ b/tests/docs/smoke-all/2024/09/24/issue-10821.qmd @@ -5,7 +5,7 @@ _quarto: tests: html: ensureFileRegexMatches: - - ['#\| fig-cap: "This figure will have ''echo: fenced'' in its caption."'] + - ['#\| fig-cap: "This figure will have ''echo: fenced'' in its caption."'] - [] --- diff --git a/tests/docs/text-highlighting/markdown-quarto-syntax.qmd b/tests/docs/text-highlighting/markdown-quarto-syntax.qmd new file mode 100644 index 00000000000..16718edcbb0 --- /dev/null +++ b/tests/docs/text-highlighting/markdown-quarto-syntax.qmd @@ -0,0 +1,112 @@ +--- +title: Markdown block with quarto syntax +format: html +_quarto: + tests: + html: + ensureHtmlElements: + - + - '#python pre.sourceCode.markdown' + - '#python span#cb1-14 span.op' + - '#ojs pre.sourceCode.markdown' + - '#ojs span#cb2-2 span.co' + - '#ojs span#cb2-7 span.op' + - '#julia pre.sourceCode.markdown' + - '#julia span#cb3-2 span.co' + - '#julia span#cb3-7 span.fu' + - '#mermaid pre.sourceCode.markdown' + - '#mermaid span#cb4-3 *:not(span)' + - '#dot pre.sourceCode.markdown' + - '#dot span#cb5-2 span.co' + - '#dot span#cb5-4 span.va' + - + - '#python span#cb1-14 span.in' + - '#ojs span#cb2-7 span.in' + - '#julia span#cb3-7 span.in' + - '#mermaid span#cb4-3 span.in' + - '#dot span#cb5-4 span.in' +--- + +## Nested markdown with highlight python {#python} + +This is a quarto document example + +```` markdown +--- +title: "Client Credentials Using the Python SDK" +format: html +--- + +# Example Client Credentials Exchange + +This Quarto document is able to acquire an OAuth access token +from a Service Account OAuth integration. + +```{{python}} +from posit import connect + +client = connect.Client() +# NOTE: get_content_credentials reads the `CONNECT_CONTENT_SESSION_TOKEN` +# from the environment to complete the credential exchange. +print(client.oauth.get_content_credentials().get("access_token")) +``` + +```` +## embedded ojs highlight {#ojs} + +````markdown +```{{ojs}} +// Comment +viewof bill_length_min = Inputs.range( + [32, 50], + {value: 35, step: 1, label: "Bill length (min):"} +) +viewof islands = Inputs.checkbox( + ["Torgersen", "Biscoe", "Dream"], + { value: ["Torgersen", "Biscoe"], + label: "Islands:" + } +) +``` +```` + +## embedded julia highlight {#julia} + +````markdown +```{{julia}} +#| label: fig-parametric +#| fig-cap: "Parametric Plots" + +using Plots + +plot(sin, + x->sin(2x), + 0, + 2π, + leg=false, + fill=(0,:lavender)) +``` +```` + +## Embedded mermaid {#mermaid} + +````markdown +```{{mermaid}} +%%| fig-width: 6.5 +flowchart LR + A[Hard edge] --> B(Round edge) + B --> C{Decision} +``` +```` + +## Embedded dot {#dot} + +````markdown +```{{dot}} +//| label: fig-linux-kernel +//| fig-cap: "A diagram of the Linux kernel." +graph { + A -- B +} +``` +````