{ "build_script": "", "build_workdir": ".", "bundle_artifact": "", "decision_relevant_fields": [ "adapter_state.smartphone_count", "adapter_state.smartphone_lower_count", "adapter_state.github_count", "adapter_state.github_lower_count" ], "execution_mode": "node", "expected_page_errors": [], "instance_id": "jackdewinter_pymarkdown_pr1105", "language": "python", "payload": {}, "predicate_description": "The fixed Markdown source contains the correctly-cased proper names 'SmartPhone' and 'GitHub' with no remaining lowercase 'smartphone' or 'github' variants in the document text.", "predicate_js": "(s) => s.adapter_state.smartphone_count >= 2 && s.adapter_state.smartphone_lower_count === 0 && s.adapter_state.github_count >= 2 && s.adapter_state.github_lower_count === 0", "product_output_kind": "rendered_document", "program_js": "import sys\nimport os\nimport json\nimport base64\nimport tempfile\n\nsys.path.insert(0, \"/testbed\")\n\nimport markdown\nfrom pymarkdown.main import PyMarkdownLint\n\n\ndef main():\n payload = json.loads(base64.b64decode(sys.argv[1]).decode(\"utf8\"))\n output_path = sys.argv[2]\n title = payload.get(\"title\", \"MD044 Auto-fix Probe\")\n\n original_markdown = \"\"\"I bought a smartphone from github last week.\n\nThe smartphone is great, and github hosts the project.\n\n`smartphone` and [github](/projects/repo \"github\") are common words.\n\"\"\"\n\n tmpdir = tempfile.mkdtemp()\n md_path = os.path.join(tmpdir, \"sample.md\")\n with open(md_path, \"w\", encoding=\"utf-8\") as f:\n f.write(original_markdown)\n\n fix_error = None\n exit_code = None\n try:\n args = [\n \"--set\",\n \"plugins.md044.names=SmartPhone,GitHub\",\n \"--set\",\n \"plugins.md044.code_blocks=$!true\",\n \"fix\",\n md_path,\n ]\n PyMarkdownLint().main(args)\n except SystemExit as e:\n exit_code = e.code if isinstance(e.code, int) else 99\n except Exception as e:\n fix_error = {\"name\": type(e).__name__, \"message\": str(e)}\n exit_code = -1\n\n try:\n with open(md_path, \"r\", encoding=\"utf-8\") as f:\n fixed_source = f.read()\n except Exception as e:\n fixed_source = original_markdown\n if fix_error is None:\n fix_error = {\"name\": type(e).__name__, \"message\": str(e)}\n\n rendered_html = markdown.markdown(\n fixed_source, extensions=[\"fenced_code\", \"tables\"]\n )\n\n smartphone_count = fixed_source.count(\"SmartPhone\")\n smartphone_lower_count = fixed_source.count(\"smartphone\")\n github_count = fixed_source.count(\"GitHub\")\n github_lower_count = fixed_source.count(\"github\")\n\n state = {\n \"fixed_source\": fixed_source,\n \"rendered_html\": rendered_html,\n \"fix_error\": fix_error,\n \"exit_code\": exit_code,\n \"smartphone_count\": smartphone_count,\n \"smartphone_lower_count\": smartphone_lower_count,\n \"github_count\": github_count,\n \"github_lower_count\": github_lower_count,\n }\n\n def esc(s):\n return (\n str(s)\n .replace(\"&\", \"&\")\n .replace(\"<\", \"<\")\n .replace(\">\", \">\")\n )\n\n page = (\n \"\\n\"\n \"\\n\"\n \"
\\n\"\n '\\n'\n f\"