import { h } from "@stencil/core";
import hljs from "highlight.js/lib/core";
import gherkin from "highlight.js/lib/languages/gherkin";
hljs.registerLanguage("gherkin", gherkin);
export const CucumberAddon = ({ story }, children) => {
  var _a;
  let code = (_a = story.parent.parameters) === null || _a === void 0 ? void 0 : _a.scenario;
  let result;
  try {
    result = hljs.highlight("gherkin", code);
  }
  catch (e) {
    // No scenario or invalid. Ignoring.
  }
  return (h("div", null,
    h("details", null,
      h("summary", null, "Specs"),
      result && h("pre", { innerHTML: result.value })),
    children));
};
