GithubHelp home page GithubHelp logo

trudbot / hexo2json Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 15 KB

Convert blogs in hexo to JSON format

Home Page: https://www.npmjs.com/package/hexo2json

License: MIT License

JavaScript 66.15% TypeScript 33.85%

hexo2json's Introduction

hexo2json

Convert blogs in hexo to JSON format!

  • Use parse to convert hexo style blog text into JSON.
  • Use stringify to convert the specified JSON format into a hexo blog.

Hexo2json helps with your blog migration!

Usage

hexo框架有如下博客格式.

---
title: blog title
mathjax: true
tags:
  - tag1
  - tag2
categories: cg1
abbrlink: 23124
date: 2023-02-27 21:46:38
---
博客的摘要、前言。
<!--more-->
博客正文

使用hexo2json, 将它转换为如下格式!

{
  meta: {
    title: 'blog title',
    mathjax: true,
    tags: [ 'tag1', 'tag2' ],
    categories: 'cg1',
    abbrlink: 23124,
    date: '2023-02-27 21:46:38'
  },
  desc: '博客的摘要、前言。',
  content: '博客正文'
}

Install through NPM and use it in a browser or node

npm install hexo2json
import Hexo from hexo2json
const blogText = "desc\n<!--more-->\ncontent";
const resultJson = Hexo.parse(blogText);
console.log(resultJson);
console.log(Hexo.stringify(resultJson));

hexo2json's People

Contributors

trudbot avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.