newjs-md
v1.0.8
Published
A custom markdown/JSON-to-Vue SFC translator with Obsidian-compatible features.
Maintainers
Readme
newjs-md
A lightweight tool to convert Markdown and JSON files into Vue Single File Components (SFC).
Installation
Install newjs-md globally:
npm install -g newjs-mdAlternatively, you can use it locally via npx:
npx newjs-mdUsage
Initialize a new project
# Global usage:
newjs-md init
# Local usage:
npx newjs-md initConvert a single file
# Global usage:
newjs-md template.md
# Local usage:
npx newjs-md template.mdWatch mode
# Global usage:
newjs-md watch
# Local usage:
npx newjs-md watchGet Help
# Global usage:
newjs-md help
# Local usage:
npx newjs-md helpFile Structure
your-project/
├── templates/ # Your markdown/JSON templates
├── pages/ # Generated Vue components
└── src/
└── components/ # Your Vue componentsTemplate Format
Markdown
@TitleBar
# My Page Title
Content goes here...JSON
{
"component": "PageLayout",
"content": "My page content"
}Configuration
Create newjsTemplate.config.json in your project root:
{
"templatesDir": "./templates",
"pagesDir": "./pages",
"componentPaths": ["./src/components"]
}Integration with Vite
To integrate with Vite, update your package.json scripts. For example, using npm-run-all:
{
"scripts": {
"dev": "run-p dev:vite dev:watch",
"dev:vite": "vite",
"dev:watch": "newjs-md watch",
"build": "vite build",
"preview": "vite preview"
}
}This configuration will run both Vite’s dev server and newjs-md’s watch mode concurrently.
License
MIT
