Skip to content

Commit 279ec60

Browse files
authored
Merge pull request #58 from behave-contrib/james.westfall/fix_decorators
Fix decorators
2 parents bd9826f + 4b06dd7 commit 279ec60

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"@testing-library/user-event": "^14.0.0",
99
"ansi-to-html": "^0.7.2",
1010
"bootstrap": "^5.3.2",
11-
"highlight.js": "^11.8.0",
11+
"highlight.js": "^11.10.0",
1212
"http-proxy-middleware": "^3.0.0",
1313
"react": "^18.2.0",
1414
"react-ace": "^13.0.0",
@@ -21,8 +21,6 @@
2121
"worker-plugin": "^5.0.1"
2222
},
2323
"scripts": {
24-
"predeploy": "npm run build",
25-
"deploy": "gh-pages -d build",
2624
"start": "react-scripts start",
2725
"build": "react-scripts build",
2826
"test": "react-scripts test",
@@ -47,6 +45,5 @@
4745
]
4846
},
4947
"devDependencies": {
50-
"gh-pages": "^6.0.0"
5148
}
5249
}

src/components/FeatureHolder.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,15 @@ class FeatureHolder extends Component {
6969
});
7070
}
7171

72+
fixKeywords(msg) {
73+
const keywords = ["and", "but", "given", "step", "then", "when"];
74+
for (const kw in keywords) {
75+
let curr_kw = keywords[kw];
76+
msg = msg.replaceAll(`${curr_kw}(`, `@${curr_kw}(`);
77+
}
78+
return msg;
79+
}
80+
7281
init() {
7382
this.worker = new Worker(workerUrl);
7483
this.terminal.current.clearStdout();
@@ -87,7 +96,8 @@ class FeatureHolder extends Component {
8796
}
8897
}
8998
if (e.data.type === "snippet") {
90-
const snippets = JSON.parse(e.data.msg);
99+
const msg = this.fixKeywords(e.data.msg);
100+
const snippets = JSON.parse(msg);
91101
this.setState({ snippets: snippets })
92102
this.setState({ ready: true })
93103
this.setState({ showSpinner: false })

src/components/PrettyBox.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ class PrettyBox extends PureComponent {
1717
}
1818

1919
componentDidMount() {
20-
hljs.highlightAll();
20+
// Stop log spamming about highlighting same element again.
21+
// See: https://github.com/highlightjs/highlight.js/issues/3761#issuecomment-2498745244
22+
document.querySelectorAll("pre code:not(.hljs)").forEach((block) => { hljs.highlightElement(block); });
2123
}
2224

2325
render() {

0 commit comments

Comments
 (0)