function remarkExtendLionDocsTransformJs({ extendDocsConfig }) {
  /**
   * @param {CodeNode} node
   */
  const visitor = node => {
    if (
      node.type === 'code' &&
      node.lang === 'js' &&
      (node.meta === 'story' || node.meta === 'preview-story' || node.meta === 'script') &&
      node.value
    ) {
      const processed = transformSync(node.value, {
        plugins: [
          ['babel-plugin-extend-docs', extendDocsConfig],
          '@babel/plugin-syntax-import-assertions',
        ],
      });
      if (processed && processed.code) {
        node.value = processed.code;
      }
    }

    if (
      node.type === 'code' &&
      node.lang === 'html' &&
      (node.meta === 'story' || node.meta === 'preview-story' || node.meta === 'script') &&
      node.value
    ) {
      node.value = replaceTags(node.value, extendDocsConfig);
    }

    return node;
  };

  /**
   * @param {Node} tree
   */
  function transformer(tree) {
    // @ts-ignore
    visit(tree, visitor);
    return tree;
  }

  return transformer;
}
@param {object} opts
@param {{changes: Array<{ tag: { from: string, to: string }}> }} opts.extendDocsConfig
@returns