Skip to content

Commit

Permalink
colour const assignee (#2733)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pangoraw authored Dec 2, 2023
1 parent b15d420 commit d686e47
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion frontend/components/CellOutput.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ import { julia_mixed } from "./CellInput/mixedParsers.js"
import { julia_andrey } from "../imports/CodemirrorPlutoSetup.js"
import { SafePreviewSanitizeMessage } from "./SafePreviewUI.js"

const prettyAssignee = assignee =>
assignee && assignee.startsWith("const ") ?
html`<span style="color: var(--cm-keyword-color)">const</span> ${assignee.slice(6,)}` :
assignee

export class CellOutput extends Component {
constructor() {
super()
Expand Down Expand Up @@ -73,6 +78,7 @@ export class CellOutput extends Component {
this.props.mime !== "application/vnd.pluto.table+object" &&
this.props.mime !== "text/plain")
const allow_translate = !this.props.errored && rich_output
console.log({ro: this.props.rootassignee})
return html`
<pluto-output
class=${cl({
Expand All @@ -82,7 +88,7 @@ export class CellOutput extends Component {
translate=${allow_translate}
mime=${this.props.mime}
>
<assignee translate=${false}>${this.props.rootassignee}</assignee>
<assignee translate=${false}>${prettyAssignee(this.props.rootassignee)}</assignee>
<${OutputBody} ...${this.props} />
</pluto-output>
`
Expand Down

0 comments on commit d686e47

Please sign in to comment.