1. Installation
SoMark has Python and JavaScript implementations. Install the package for the language you use. Both packages provide the SDK and thesomark CLI command. As a baseline, Python requires 3.10+ and Node.js requires 18+.
If you install both the Python and JS versions, the CLI uses whichever one was installed first. The later installation skips CLI setup when it sees that the command already exists. To see which implementation is active, run
somark --help; the footer shows [PY] or [JS].2. Authentication and configuration
Remote parsing and usage queries require an API key. Local PDF processing and SoMarkDown preview do not. You can save configuration through the CLI, or pass parameters directly when initializing the SDK.- CLI
- Python
- JavaScript
Entry points:
somark login, somark config ..., or configuration through command flags and environment variables.Command flags / environment variablesConfig file fields
Priority: command flags > environment variables > config file > defaults.
3. Warnings
SoMark warnings fall into two categories: API warnings and local warnings. API warnings come from the top-level response fieldwarnings: List[str], at the same level as code and message. Local warnings come from SDK or CLI runtime checks, such as a batch parsing concurrency setting above the default quota.
The CLI shows SoMark warnings by default. Use the global --no-warnings option when you need quiet output:
CLI
--no-warnings only hides warning display. It does not change command results, exit codes, or remove the warnings field from SDK response objects.
The SDK shows warnings through the native warning channel of each language by default, and also keeps warning strings in the response object’s warnings field. An empty array means there are no warnings.
4. Parsing
Parsing is the main task for SoMark SDK + CLI. You give SoMark a file, and it returns Markdown, JSON, or a ZIP download URL. The default output format ismd, which corresponds to the API’s markdown output.
There are two usage patterns: sync parsing and async parsing.
Sync parsing is for “I need the result now” scenarios. The CLI or SDK sends the file to /parse/sync and waits for the server to return the result. It takes little code, has low mental overhead, and works well for single files, scripts, debugging, and small to medium documents. The tradeoff is direct: the larger the file, the longer you wait.
Async parsing is for large files, batch processing, and background tasks. You send the file to /parse/async, immediately get a task_id, then query /parse/async_check with that task_id for progress. The CLI --wait option and SDK task.wait() helper are polling wrappers. This is a better fit for queues, scheduled jobs, and server-side flows.
Sync parsing flow
One request returns the result directly. Best for scripts, debugging, and small to medium files.
Async parsing flow Submit the task first, then query status by
task_id. Best for large files, batch processing, and background queues.
4.1 Sync parsing
Sync parsing is the easiest way to prove the flow works: provide one file, wait for the result, and save it locally. Start withmd, check the content quality, then add json, zip, or page feature options as needed.
- CLI
- Python
- JavaScript
Entry point:
somark parse [files...].Return handling
--out only means the output target. It does not mean “create the directory for me” or “treat this filename as a template”. This makes script behavior easier to predict.Multi-file execution
4.2 Async parsing
Async parsing is best for large files and batch processing. Submit first, get atask_id, then poll until success or failure. A 3 to 5 second polling interval is recommended; avoid polling too frequently, because the server needs time to work.
- CLI
- Python
- JavaScript
Entry points:
somark parse [files...] --async to submit tasks; somark parse --task-id task_xxx to query a task.Submit task: somark parse [files...] --asyncWhen submitting multiple files asynchronously, each file receives its own
task_id. The CLI shows each file’s existence, submission status, duration, and task ID.Query / wait task: somark parse --task-id task_xxx5. Usage query
Usage query returns the remaining quota and dashboard URL for the current API key. It can also quickly verify whether the API key is valid.- CLI
- Python
- JavaScript
Entry point:
somark usage.Command parametersOutput fields
6. SoMarkDown service
The SoMarkDown service starts a local preview server and opens a.md or .smd file in the browser. It does not require an API key and does not consume quota. The underlying rendering capability comes from SoMarkAI/SoMarkDown; go there when you need syntax and renderer details.
The JavaScript SDK also exports
SoMarkDown. It does not start a local HTTP service; instead, it renders
Markdown / SoMarkDown strings directly to HTML. Use it in Node services, custom frontends, or small tools
when you need the rendered result.JavaScript
- CLI
- Python
- JavaScript
Entry point:
somark preview [file].Output fields
Stop the service by pressing Ctrl+C in the terminal.
7. PDF processing
PDF processing currently provides local PDF-to-image conversion. Use it for previews, page layout debugging, or handing PDF pages to another visual processing flow. The Python-side local PDF capability is based on SoMarkAI/SoPDF.- CLI
- Python
- JavaScript
Entry point:
somark pdf toimg <file>.Output fields
8. Doctor auto-fix
Doctor checks installation status, network access, API key configuration, and local preview assets. It is a command-line health check. It will not fix everything, but it catches many basic failures.CLI

