{"id":18904,"library":"voc","title":"VOC","description":"VOC (Very Ornate Code) is a generalized literate programming framework for JavaScript and compile-to-JS languages. It processes Markdown files, extracting code blocks delimited by triple backticks and directing them to specified output files based on hints after the opening backticks. Version 1.2.0 is stable but sees infrequent updates; it supports Node.js >=0.8 and browser usage. Unlike more modern literate programming tools, VOC focuses on simplicity and integration with existing Markdown workflows, offering a preprocessor API for custom language handlers.","status":"maintenance","version":"1.2.0","language":"javascript","source_language":"en","source_url":"git://github.com/SheetJS/voc","tags":["javascript","literate","programming","voc"],"install":[{"cmd":"npm install voc","lang":"bash","label":"npm"},{"cmd":"yarn add voc","lang":"bash","label":"yarn"},{"cmd":"pnpm add voc","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"VOC exports a global `VOC` object in browsers; for Node.js, use the correct import path. CommonJS require works but returns an object with `run` and `add` methods.","wrong":"const voc = require('voc');","symbol":"VOC","correct":"import { VOC } from 'voc'"},{"note":"`run` is a method of the `VOC` object, not a named export. Destructuring from require may not work as expected.","wrong":"const { run } = require('voc');","symbol":"run","correct":"import { VOC } from 'voc'; VOC.run(src);"},{"note":"Similar to `run`, `add` is a method on `VOC`. Direct assignment may cause context issues.","wrong":"const add = require('voc').add;","symbol":"add","correct":"import { VOC } from 'voc'; VOC.add(lang, handler);"}],"quickstart":{"code":"const { VOC } = require('voc');\nconst fs = require('fs');\nconst src = fs.readFileSync('myfile.md', 'utf8');\nVOC.run(src);\n// The output files are written to the current directory based on the markdown hints.","lang":"javascript","description":"Shows how to use VOC programmatically to process a Markdown file with code blocks."},"warnings":[{"fix":"Include the required scripts before using VOC in a browser.","message":"VOC relies on third-party libraries (marked.js, coffee-script.js) for browser usage; these are not bundled and must be loaded separately.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Avoid using VOC with multiple concurrent scripts; consider using separate scopes or a wrapper function.","message":"VOC uses global variables for language handlers. If multiple instances are used, they share state.","severity":"breaking","affected_versions":"<2.0.0"},{"fix":"Upgrade to >=1.0.0 and use `VOC.run()`.","message":"Versions prior to 1.0 had a different API with `VOC.parse` instead of `VOC.run`. The old API is no longer supported.","severity":"deprecated","affected_versions":"<1.0.0"},{"fix":"Ensure unique output paths per code block to avoid unintended overwrites.","message":"Output files are overwritten without warning. If the same output is specified in multiple code blocks, only the last one is kept.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"For modern environments, consider using a newer literate programming tool that supports ESM and async/await.","message":"Node.js engine requirement is >=0.8, which may cause issues on older systems. No support for newer ESM or async features.","severity":"breaking","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Ensure you have loaded VOC properly: use `const { VOC } = require('voc');` in Node or include the script tag in browser.","cause":"Incorrect import or missing global object in browser.","error":"TypeError: VOC.run is not a function"},{"fix":"Add `<script src=\"path/to/voc.js\"></script>` before using VOC.","cause":"VOC script not included or not loaded in browser.","error":"ReferenceError: VOC is not defined"},{"fix":"Run `npm install voc` in your project directory.","cause":"VOC not installed or not present in node_modules.","error":"Module not found: Error: Can't resolve 'voc'"},{"fix":"Use `const { VOC } = require('voc');` instead of `import`.","cause":"Using ES module import syntax in a CommonJS environment without transpilation.","error":"SyntaxError: Unexpected token 'export'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}