Mini Tools - Create code block with syntax highlight for Blogger

Mini Tools - Create code block with syntax highlight for Blogger

Mini Tools

Mini Tools Application provides useful tools for online to create code block,...

{tocify} $title={Table of Content}

Technologies

Install Highligh.js package

npm install highlight.js
# or
yarn add highlight.js

How to use highlight.js

  • Add "./node_modules/highlight.js/styles/atom-one-dark.css" to architect -> build -> styles of angular.json
  • You can replace atom-one-dark.css with other css file in the ./node_modules/highlight.js/styles folder

// Import the highlight.js library, including all languages
import hljs from 'highlight.js';
// For a smaller footprint, only load common subset of languages
import hljs from 'highlight.js/lib/common';

// Highlight code with auto detect language
const highlightedCode = hljs.highlightAuto('<span>Hello World!</span>').value
// Highlight code with specific language
const highlightedCode = hljs.highlight('<span>Hello World!</span>', {language: 'xml'}).value

Create code block with syntax highlight for post of Blogger

Tool giúp tạo ra những đoạn code ví dụ đẹp để viết blog hoặc làm website liên quan đến lập trình.


Tool Format Code

Đăng nhận xét

Mới hơn Cũ hơn