
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@webeach/code-parser
Advanced tools
Parse code strings into HTML or HAST with syntax highlighting for the WebEach ecosystem
@webeach/code-parser🔥 Code parser & syntax highlighter based on lowlight, used across the WebEach ecosystem to highlight code snippets consistently in Markdown, blogs, documentation, and extra UI components.
Converts raw code strings into:
_token-*)yarn add @webeach/code-parser
import { parseCodeToHast } from '@webeach/code-parser';
const hast = parseCodeToHast(`const foo = 'bar'`, 'typescript');
import { parseCodeToHtml } from '@webeach/code-parser';
const html = parseCodeToHtml(`const foo = 'bar'`, 'typescript');
// <span class="_token-keyword">const</span> foo = ...
import type { LangKey } from '@webeach/code-parser';
const lang: LangKey = 'typescript'; // autocomplete-safe
Supported languages:
bashcsshtmljavascriptjsonlessmarkdownscssshellsqlstylustypescriptxmlyamlThis library outputs class names like _token-keyword, _token-string, etc.
You can map these to your design system using CSS:
._token-comment,
._token-quote {
color: var(--color-neutral-6);
font-style: italic;
}
._token-doctag,
._token-formula,
._token-keyword,
._token-name {
color: var(--color-primary-7);
}
._token-section,
._token-selector-tag,
._token-deletion,
._token-subst {
color: var(--color-danger-9);
}
._token-literal,
._token-number {
color: var(--color-secondary-7);
}
._token-string,
._token-regexp,
._token-addition,
._token-attribute,
._token-meta ._token-string {
color: var(--color-success-8);
}
._token-attr,
._token-variable,
._token-template-variable,
._token-type,
._token-selector-class,
._token-selector-attr,
._token-selector-pseudo {
color: var(--color-warning-9);
}
._token-symbol,
._token-bullet,
._token-link,
._token-meta,
._token-selector-id,
._token-title {
color: var(--color-secondary-7);
}
._token-built_in,
._token-title.class_,
._token-class ._token-title {
color: var(--color-warning-8);
}
._token-emphasis {
font-style: italic;
}
._token-strong {
font-weight: bold;
}
._token-link {
text-decoration: underline;
}
Compiles the codebase and generates the production-ready output in the lib directory.
yarn run build
Watches for file changes and rebuilds automatically.
yarn run build:watch
Releases are handled automatically using semantic-release.
Before publishing a new version, make sure to:
main branch.feat: ... — for new featuresfix: ... — for bug fixeschore: ..., refactor: ..., etc.patch, minor, major).Developed and maintained by Ruslan Martynov
If you have any suggestions or find a bug, feel free to open an issue or pull request.
This package is licensed under the MIT License.
FAQs
Parse code strings into HTML or HAST with syntax highlighting for the WebEach ecosystem
We found that @webeach/code-parser demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.