Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,14 @@ export default async function enhance(
evaluatedOutputExpression.data.valueStringRepresentation,
);
break;
case OutputFormat.H:
$result = $(
`${evaluatedOutputExpression.data.valueStringRepresentation}`
.replace(/\\"/g, '"')
.replace(/^"/, "")
.replace(/"$/, ""),
);
break;
case OutputFormat.J:
$result = $(`<pre data-role="codeBlock" />`);
resultNormalizedInfo = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,19 @@ export default async function enhance(
};
resultText = text;
break;
case BlockOutputFormat.H:
try {
$result = $(data);
} catch (e) {
$result = $(`<pre data-role="codeBlock" />`);
resultNormalizedInfo = {
language: "",
attributes: {},
style: "display: inline-block",
};
resultText = e.message;
}
break;
case BlockOutputFormat.J:
$result = $(`<pre data-role="codeBlock" />`);
resultNormalizedInfo = {
Expand Down
5 changes: 5 additions & 0 deletions packages/litvis/src/attributeDerivatives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ export function extractAttributeDerivatives(
isLitVis = true;
addOutputExpressions(result, OutputFormat.J, value);
break;
case "h":
case "html":
isLitVis = true;
addOutputExpressions(result, OutputFormat.H, value);
break;
case "interactive":
result.interactive = !!value;
break;
Expand Down
4 changes: 4 additions & 0 deletions packages/litvis/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export enum OutputFormat {
R = "r",
/** json */
J = "j",
/** html */
H = "h",
/** visual */
V = "v",
}
Expand All @@ -28,6 +30,8 @@ export enum BlockOutputFormat {
R = "r",
/** json */
J = "j",
/** html */
H = "h",
/** visual */
V = "v",

Expand Down