diff --git a/advocacy_docs/playground/1/01_examples/code-blocks.mdx b/advocacy_docs/playground/1/01_examples/code-blocks.mdx index 4ba74dcf2a0..cd492c9f1ef 100644 --- a/advocacy_docs/playground/1/01_examples/code-blocks.mdx +++ b/advocacy_docs/playground/1/01_examples/code-blocks.mdx @@ -33,3 +33,13 @@ asdasd asdasd asdasdafasfa + +```sql +SELECT * FROM aidb.retrieve_text('test_knowledge_base', 'jacket', 2); +__OUTPUT__ + key | value | distance +-------+----------------------------------------------------+-------------------- + 19337 | United Colors of Benetton Men Stripes Black Jacket | 0.2994317672742334 + 55018 | Lakme 3 in 1 Orchid Aqua Shine Lip Color | 0.3804609668507203 +(2 rows) +``` diff --git a/product_docs/docs/hadoop_data_adapter/2/10c_example_order_by_pushdown.mdx b/product_docs/docs/hadoop_data_adapter/2/10c_example_order_by_pushdown.mdx index 8f5e6fbb859..ce54db3370e 100644 --- a/product_docs/docs/hadoop_data_adapter/2/10c_example_order_by_pushdown.mdx +++ b/product_docs/docs/hadoop_data_adapter/2/10c_example_order_by_pushdown.mdx @@ -69,7 +69,9 @@ __OUTPUT__ --------------------- Foreign Scan on emp (1 row) +``` +```sql edb=# SET hdfs_fdw.enable_order_by_pushdown TO OFF; SET edb=# EXPLAIN (COSTS OFF) SELECT * FROM emp order by deptno; diff --git a/product_docs/docs/pgd/5.7/quickstart/quick_start_aws.mdx b/product_docs/docs/pgd/5.7/quickstart/quick_start_aws.mdx index df28a4ee2b6..2afe7714d78 100644 --- a/product_docs/docs/pgd/5.7/quickstart/quick_start_aws.mdx +++ b/product_docs/docs/pgd/5.7/quickstart/quick_start_aws.mdx @@ -275,7 +275,8 @@ Connections Ok All BDR nodes are accessible Raft Ok Raft Consensus is working correctly Replication Slots Ok All PGD replication slots are working correctly Clock Skew Ok Clock drift is within permissible limit -Versions Ok All nodes are running the same PGD version``` +Versions Ok All nodes are running the same PGD version +``` Or, you can use `pgd nodes list` to ask PGD to show you the data-bearing nodes in the cluster: diff --git a/product_docs/docs/pgd/5.8/quickstart/quick_start_aws.mdx b/product_docs/docs/pgd/5.8/quickstart/quick_start_aws.mdx index df28a4ee2b6..2afe7714d78 100644 --- a/product_docs/docs/pgd/5.8/quickstart/quick_start_aws.mdx +++ b/product_docs/docs/pgd/5.8/quickstart/quick_start_aws.mdx @@ -275,7 +275,8 @@ Connections Ok All BDR nodes are accessible Raft Ok Raft Consensus is working correctly Replication Slots Ok All PGD replication slots are working correctly Clock Skew Ok Clock drift is within permissible limit -Versions Ok All nodes are running the same PGD version``` +Versions Ok All nodes are running the same PGD version +``` Or, you can use `pgd nodes list` to ask PGD to show you the data-bearing nodes in the cluster: diff --git a/src/components/code-block.js b/src/components/code-block.js index 0a901c982bb..81100638ad6 100644 --- a/src/components/code-block.js +++ b/src/components/code-block.js @@ -2,6 +2,7 @@ import React, { useState } from "react"; import { Button } from "react-bootstrap"; import { Tooltip } from "react-bootstrap"; import { OverlayTrigger } from "react-bootstrap"; +import { useLocation } from "@gatsbyjs/reach-router"; const childToString = (child) => { if (typeof child === "string") { @@ -22,12 +23,13 @@ const popExtraNewLines = (code) => { } }; -const splitChildrenIntoCodeAndOutput = (rawChildren) => { +const splitChildrenIntoCodeAndOutput = (rawChildren, urlpath) => { if (!rawChildren) { return [[], []]; } - const splitRegex = /(?:\s+|^)__OUTPUT__\s*(?:\n+|$)/; + // Simplified regex to split on the __OUTPUT__ marker + const splitRegex = /(?:\n|^)[ \t\f\v]*__OUTPUT__[ \t\f\v]*(?:\n|$)/; const code = []; const output = []; @@ -40,6 +42,12 @@ const splitChildrenIntoCodeAndOutput = (rawChildren) => { if (splitFound) { // we've already split, toss it into output and move on output.push(childToString(child)); + // warn if we do find another __OUTPUT__ marker - this is likely a mistake + if (splitRegex.test(output.at(-1))) + console.warn( + urlpath + + ": Found another __OUTPUT__ marker after the first one, this is likely a mistake.", + ); continue; } @@ -151,10 +159,11 @@ const OutputPre = ({ content }) => ( ); const CodeBlock = ({ children, codeLanguages, ...otherProps }) => { + const location = useLocation(); const childIsComponent = !!children.props; // true in normal usage, false if raw
 tags are used
 
   const [codeContent, outputContent] = childIsComponent
-    ? splitChildrenIntoCodeAndOutput(children.props.children)
+    ? splitChildrenIntoCodeAndOutput(children.props.children, location.pathname)
     : [children, ""];
 
   const startWrapped = false;