Giter Club home page Giter Club logo

blog's People

Contributors

srivatsansenthilkumar avatar vitonsky avatar

Watchers

 avatar

blog's Issues

Use MD compiller to AST instead of JS code

Currently we use next-mdx-remote package to compile MD/MDX files to react view.
This package compile markdown text to a javascript that execute in eval later.

This approach is potentially dangerous, because next-mdx-remote can insert any code and eval it later.

We have to compile markdown text to abstract syntax tree and render this tree later

{
	"pageProps": {
		"post": {
			"url": "/blog/2022/05/22/first-post",
			"source": {
				"compiledSource": "/*@jsxRuntime automatic @jsxImportSource react*/\nconst {Fragment: _Fragment, jsx: _jsx, jsxs: _jsxs} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n  const _components = Object.assign({\n    p: \"p\"\n  }, _provideComponents(), props.components);\n  return _jsxs(_Fragment, {\n    children: [_jsx(_components.p, {\n      children: \"Welcome to my blog. I've create it to expressing my opinion, primarily about programming.\"\n    }), \"\\n\", _jsx(_components.p, {\n      children: \"My plan are writing ideas to my blog and refer other people here later, to avoid repeating my point many times.\"\n    }), \"\\n\", _jsx(_components.p, {\n      children: \"Today, social media are hide posts of people with undesirable points of view and even remove all their content. Users is not have control on own posts. This is why i create my blog instead of account on popular site.\"\n    })]\n  });\n}\nfunction MDXContent(props = {}) {\n  const {wrapper: MDXLayout} = Object.assign({}, _provideComponents(), props.components);\n  return MDXLayout ? _jsx(MDXLayout, Object.assign({}, props, {\n    children: _jsx(_createMdxContent, props)\n  })) : _createMdxContent(props);\n}\nreturn {\n  default: MDXContent\n};\n",
				"scope": {}
			},
			"previewText": "Welcome to my blog. I've create it to expressing my opinion, primarily about programming.",
			"readingTime": {
				"minutes": 0.365,
				"words": 73
			},
			"date": 1653175800000,
			"title": "First post",
			"previewImage": null,
			"coverImage": null,
			"description": null,
			"lang": null,
			"tags": [],
			"keywords": []
		}
	},
	"__N_SSG": true
}

Use native font style

Use native font style -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif

Make code stable

  • Refactor posts processor
  • Make API stable
  • Fix bug when rename post and attachment with relative path delete and make "unavailable"
  • Write roadmap how to unify server to use in other projects about SSG

Move API server to standalone service

Let's split logic to API server and blog frontend + BFF.

We should have 3 directory:

  • content: posts, images, attachments
  • server: content processing
  • site: frontend and all things to generate static site

Something like this for inspiration https://github.com/bmshamsnahid/Markdown-Blog-Parser
We can make package from this.

Server responsibility:

  • Process a md/mdx files to any formats
  • Provide an API to build any site structure

Features:

  • Process files as once as and in watch mode
  • Extensible API
  • User can specify parameters in config, including basePath for site, path to directory with content and fsRoot which limit top directory to access to content files

Compress the images

We have to compress images, but keep legacy urls.

We may compress images, but use hash of original file as before

Write about blog

  • Write post about blog
  • Update readme and description
  • Add info about how to build it

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.