Skip to content

Commit

Permalink
Merge pull request #990 from WolframResearch/bugfix/enable-code-capti…
Browse files Browse the repository at this point in the history
…ons-in-code-blocks

Bugfix: Enable code captions in code blocks
  • Loading branch information
rhennigan authored Dec 18, 2024
2 parents f73f0a4 + c48d846 commit aa243a4
Showing 1 changed file with 24 additions and 18 deletions.
42 changes: 24 additions & 18 deletions Source/Chatbook/Formatting.wl
Original file line number Diff line number Diff line change
Expand Up @@ -909,24 +909,24 @@ attachCopiedTooltip[ ] :=
StyleBox[
FEPrivate`ImportImage[
FrontEnd`FileName[{"Typeset", "ClickToCopy"}, "Checkmark.png"]],
Magnification -> 0.5`]],
BaselinePosition -> Scaled[0.1`] -> Baseline],
Magnification -> 0.5`]],
BaselinePosition -> Scaled[0.1`] -> Baseline],
DynamicBox[
ToBoxes[FEPrivate`FrontEndResource["FEStrings",
"clicktocopyDoneTooltip"], StandardForm]]}},
ToBoxes[FEPrivate`FrontEndResource["FEStrings",
"clicktocopyDoneTooltip"], StandardForm]]}},
GridBoxAlignment -> {"Columns" -> {{Left}}, "Rows" -> {{Baseline}}},
GridBoxItemSize -> {"Columns" -> {{Automatic}},
"Rows" -> {{Automatic}}},
GridBoxSpacings -> {"Columns" -> {{0.3`}}, "Rows" -> {{0}}}],
Alignment -> Center,
Appearance -> {"Default" ->
FrontEnd`FileName[{"Chatbook"}, "CopyTooltip.9.png"]}, ImageSize -> {100, Automatic},
FrameMargins -> {{0, 0}, {0, 0}},
BaseStyle -> {LineBreakWithin -> Automatic,
LinebreakAdjustments -> {1.`, 10, 1, 0, 1}, LineIndent -> 0,
Hyphenation -> False,
GridBoxItemSize -> {"Columns" -> {{Automatic}},
"Rows" -> {{Automatic}}},
GridBoxSpacings -> {"Columns" -> {{0.3`}}, "Rows" -> {{0}}}],
Alignment -> Center,
Appearance -> {"Default" ->
FrontEnd`FileName[{"Chatbook"}, "CopyTooltip.9.png"]}, ImageSize -> {100, Automatic},
FrameMargins -> {{0, 0}, {0, 0}},
BaseStyle -> {LineBreakWithin -> Automatic,
LinebreakAdjustments -> {1.`, 10, 1, 0, 1}, LineIndent -> 0,
Hyphenation -> False,
HyphenationOptions -> {"HyphenationCharacter" -> "\[Null]"},
FontFamily -> "Source Sans Pro", FontSize -> 12,
FontFamily -> "Source Sans Pro", FontSize -> 12,
FontColor -> GrayLevel[0.5]}],
Alignment -> { Center, Bottom },
FrameMargins -> 0,
Expand All @@ -935,7 +935,7 @@ attachCopiedTooltip[ ] :=
] ],
{ Center, Bottom }, Offset[ { 0, -7 }, Automatic ], { Center, Center },
RemovalConditions -> { "MouseExit" }
];
];

attachCopiedTooltip // endDefinition;

Expand Down Expand Up @@ -1941,7 +1941,10 @@ makeInteractiveCodeCell[ lang_String? wolframLanguageQ, code0_ ] := Enclose[
LanguageCategory -> "Input",
ShowAutoStyles -> True,
ShowStringCharacters -> True,
ShowSyntaxStyles -> True
ShowSyntaxStyles -> True,
TranslationOptions -> {
"Enabled" -> Dynamic @ AbsoluteCurrentValue[ $FrontEnd, { TranslationOptions, "Enabled" } ]
}
];
handler = inlineInteractiveCodeCell[ display, code ];
codeBlockFrame[ ToBoxes @ handler, code ]
Expand Down Expand Up @@ -2418,7 +2421,10 @@ attachment[ alt_String, key_String, expr_ ] :=
LanguageCategory -> "Input",
ShowAutoStyles -> True,
ShowStringCharacters -> True,
ShowSyntaxStyles -> True
ShowSyntaxStyles -> True,
TranslationOptions -> {
"Enabled" -> Dynamic @ AbsoluteCurrentValue[ $FrontEnd, { TranslationOptions, "Enabled" } ]
}
];
handler = inlineInteractiveCodeCell[ display, Cell[ BoxData @ cachedBoxes @ expr, "Input" ] ];
codeBlockFrame[ Cell @ BoxData @ ToBoxes @ handler, expr ]
Expand Down

0 comments on commit aa243a4

Please sign in to comment.