Download data/rs/probes/jackdewinter_pymarkdown_pr1105.json from simonlqy/ProWM-Bench: direct link, hf CLI and curl.
- Browser
- Download file 5.47 kB
-
https://huggingface.co/datasets/simonlqy/ProWM-Bench/resolve/main/data/rs/probes/jackdewinter_pymarkdown_pr1105.json
- Command line
-
hf download hf://datasets/simonlqy/ProWM-Bench/data/rs/probes/jackdewinter_pymarkdown_pr1105.json
-
curl -L -o jackdewinter_pymarkdown_pr1105.json https://huggingface.co/datasets/simonlqy/ProWM-Bench/resolve/main/data/rs/probes/jackdewinter_pymarkdown_pr1105.json
5.47 kB
| { | |
| "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 \"<!doctype html>\\n\"\n \"<html>\\n\"\n \"<head>\\n\"\n '<meta charset=\"utf-8\">\\n'\n f\"<title>{esc(title)}</title>\\n\"\n \"<style>\\n\"\n \"body { font-family: system-ui, -apple-system, sans-serif; max-width: 720px; margin: 2rem auto; padding: 0 1rem; line-height: 1.6; color: #222; }\\n\"\n \"code { background: #f0f0f0; padding: 0.15rem 0.3rem; border-radius: 3px; font-family: ui-monospace, monospace; }\\n\"\n \"pre { background: #f5f5f5; padding: 1rem; border-radius: 4px; overflow-x: auto; }\\n\"\n \"a { color: #0066cc; }\\n\"\n \"</style>\\n\"\n \"</head>\\n\"\n \"<body>\\n\"\n '<main id=\"rendered\">\\n'\n f\"{rendered_html}\\n\"\n \"</main>\\n\"\n \"<script>window.__WM_STATE__=\"\n + json.dumps(state).replace(\"<\", \"\\\\u003c\")\n + \";window.__WM_READY__=true;</script>\\n\"\n \"</body>\\n\"\n \"</html>\\n\"\n )\n\n with open(output_path, \"w\", encoding=\"utf-8\") as f:\n f.write(page)\n\n trace_path = os.environ.get(\"WMMB_MODULE_TRACE_PATH\")\n if trace_path:\n loaded = sorted(\n {\n m.__file__\n for m in sys.modules.values()\n if getattr(m, \"__file__\", None) and \"/testbed/\" in m.__file__\n }\n )\n with open(trace_path, \"w\", encoding=\"utf-8\") as f:\n json.dump({\"repository_modules_loaded\": loaded}, f)\n\n\nif __name__ == \"__main__\":\n main()", | |
| "rationale": "The issue requests auto-fix for Rule MD044; this Python probe writes a Markdown file with lowercase proper names, invokes pymarkdown's fix mode with configured names, and renders the resulting corrected Markdown as HTML so base leaves the names unchanged while gold rewrites them.", | |
| "repo": "jackdewinter/pymarkdown", | |
| "schema_version": "worldmodelmmbench.render-probe.v3", | |
| "title": "MD044 auto-fix rewrites improperly cased proper names", | |
| "viewport": [ | |
| 1280, | |
| 960 | |
| ], | |
| "volatile_fields": [] | |
| } | |