import { isMobile } from '../util/env' /** * Render github corner * @param {Object} data * @return {String} */ export function corner (data) { if (!data) return '' if (!/\/\//.test(data)) data = 'https://github.com/' + data data = data.replace(/^git\+/, '') return ( `` + '' + '') } /** * Render main content */ export function main (config) { const aside = ( '' + '') return (isMobile ? `${aside}
` : `
${aside}`) + '
' + '
' + '
' + '
' } /** * Cover Page */ export function cover () { const SL = ', 100%, 85%' const bgc = 'linear-gradient(to left bottom, ' + `hsl(${Math.floor(Math.random() * 255) + SL}) 0%,` + `hsl(${Math.floor(Math.random() * 255) + SL}) 100%)` return `
` + '
' + '
' + '
' } /** * Render tree * @param {Array} tree * @param {String} tpl * @return {String} */ export function tree (toc, tpl = '') { if (!toc || !toc.length) return '' toc.forEach(node => { tpl += `
  • ${node.title}
  • ` if (node.children) { tpl += `
  • ` } }) return tpl } export function helper (className, content) { return `

    ${content.slice(5).trim()}

    ` } export function theme (color) { return `` }