update doc (and builtin)
This commit is contained in:
380
core/builtin.lua
380
core/builtin.lua
@@ -1,3 +1,5 @@
|
||||
local std = require("core.std")
|
||||
|
||||
local M = {}
|
||||
M.__index = M
|
||||
|
||||
@@ -17,238 +19,181 @@ function M.site_builder(header, footer)
|
||||
version = site_config.version or "",
|
||||
title = site_config.title or "Document",
|
||||
header = header or [[
|
||||
<!DOCTYPE html>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{{TITLE}}</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<title>{{TITLE}}</title>
|
||||
<style>
|
||||
html,
|
||||
body {
|
||||
height: 100%
|
||||
}
|
||||
html,body{
|
||||
min-height:100%;
|
||||
background:#0f1113;
|
||||
}
|
||||
body{
|
||||
margin:0;
|
||||
padding:36px;
|
||||
font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
|
||||
background:#0f1113;
|
||||
color:#e6eef3;
|
||||
line-height:1.45
|
||||
}
|
||||
.container{max-width:1100px;margin:0 auto}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
||||
background: #0f1113;
|
||||
color: #e6eef3;
|
||||
line-height: 1.45;
|
||||
padding: 36px;
|
||||
}
|
||||
h1,h2,h3,h4,h5,h6{
|
||||
font-weight:600;
|
||||
margin:0 0 12px 0
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 1100px;
|
||||
margin: 0 auto
|
||||
}
|
||||
details {
|
||||
background:#17191b;
|
||||
border:1px solid rgba(255,255,255,.06);
|
||||
border-radius:4px;
|
||||
padding:12px 14px;
|
||||
margin:14px 0;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 40px;
|
||||
margin: 0 0 18px 0;
|
||||
font-weight: 700;
|
||||
}
|
||||
details summary {
|
||||
list-style: none;
|
||||
cursor: pointer;
|
||||
font-weight:600;
|
||||
color:#e6eef3;
|
||||
}
|
||||
|
||||
.note {
|
||||
background: #17191b;
|
||||
border: 1px solid rgba(255, 255, 255, 0.06);
|
||||
padding: 18px;
|
||||
border-radius: 4px;
|
||||
margin: 12px 0 26px 0;
|
||||
color: #dfe9ee;
|
||||
}
|
||||
details summary::-webkit-details-marker {
|
||||
display:none;
|
||||
}
|
||||
|
||||
.note strong {
|
||||
color: #f0f6f8
|
||||
}
|
||||
details summary::before {
|
||||
content:"▸";
|
||||
display:inline-block;
|
||||
margin-right:8px;
|
||||
transition:transform .15s ease;
|
||||
color:#68a6ff;
|
||||
}
|
||||
|
||||
.callout {
|
||||
display: block;
|
||||
margin: 10px 0
|
||||
}
|
||||
details[open] summary::before {
|
||||
transform:rotate(90deg);
|
||||
}
|
||||
|
||||
a {
|
||||
color: #68a6ff;
|
||||
text-decoration: none
|
||||
}
|
||||
details > *:not(summary) {
|
||||
margin-top:10px;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline
|
||||
}
|
||||
h1{font-size:40px;margin-bottom:18px;font-weight:700}
|
||||
h2{font-size:32px;margin:24px 0 14px}
|
||||
h3{font-size:26px;margin:20px 0 12px}
|
||||
h4{font-size:20px;margin:16px 0 10px}
|
||||
h5{font-size:16px;margin:14px 0 8px}
|
||||
h6{font-size:14px;margin:12px 0 6px;color:#9aa6b1}
|
||||
|
||||
p {
|
||||
margin: 12px 0
|
||||
}
|
||||
p{margin:12px 0}
|
||||
|
||||
.muted {
|
||||
color: #9aa6b1
|
||||
}
|
||||
a{
|
||||
color:#68a6ff;
|
||||
text-decoration:none
|
||||
}
|
||||
a:hover{text-decoration:underline}
|
||||
|
||||
.lead {
|
||||
font-size: 15px;
|
||||
margin-top: 8px
|
||||
}
|
||||
.note,pre,code{
|
||||
background:#17191b;
|
||||
border:1px solid rgba(255,255,255,.06)
|
||||
}
|
||||
.note{
|
||||
padding:18px;
|
||||
border-radius:4px;
|
||||
margin:12px 0 26px;
|
||||
color:#dfe9ee
|
||||
}
|
||||
.note strong{color:#f0f6f8}
|
||||
|
||||
.highlight {
|
||||
font-weight: 700;
|
||||
color: #cde7ff
|
||||
}
|
||||
.muted{color:#9aa6b1}
|
||||
|
||||
.small {
|
||||
font-size: 13px;
|
||||
color: #9aa6b1;
|
||||
margin-top: 6px
|
||||
}
|
||||
.lead{font-size:15px;margin-top:8px}
|
||||
.small{font-size:13px;color:#9aa6b1;margin-top:6px}
|
||||
.highlight{font-weight:700;color:#cde7ff}
|
||||
|
||||
.links {
|
||||
margin: 10px 0
|
||||
}
|
||||
ul,ol{margin:12px 0;padding-left:24px}
|
||||
li{margin:6px 0}
|
||||
|
||||
.section {
|
||||
margin-top: 18px
|
||||
}
|
||||
code{
|
||||
padding:2px 6px;
|
||||
border-radius:3px;
|
||||
font-family:"SF Mono",Monaco,"Cascadia Code","Roboto Mono",Consolas,"Courier New",monospace;
|
||||
font-size:.9em;
|
||||
color:#cde7ff
|
||||
}
|
||||
pre{
|
||||
padding:18px;
|
||||
border-radius:4px;
|
||||
margin:12px 0;
|
||||
overflow-x:auto;
|
||||
font-family:"SF Mono",Monaco,"Cascadia Code","Roboto Mono",Consolas,"Courier New",monospace;
|
||||
font-size:14px;
|
||||
line-height:1.5
|
||||
}
|
||||
pre code{
|
||||
background:none;
|
||||
border:none;
|
||||
padding:0;
|
||||
font-size:inherit
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 32px;
|
||||
margin: 24px 0 14px 0;
|
||||
font-weight: 600;
|
||||
}
|
||||
blockquote{
|
||||
border-left:3px solid #68a6ff;
|
||||
padding-left:18px;
|
||||
margin:12px 0;
|
||||
color:#dfe9ee;
|
||||
font-style:italic
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 26px;
|
||||
margin: 20px 0 12px 0;
|
||||
font-weight: 600;
|
||||
}
|
||||
hr{
|
||||
border:none;
|
||||
border-top:1px solid rgba(255,255,255,.1);
|
||||
margin:24px 0
|
||||
}
|
||||
|
||||
h4 {
|
||||
font-size: 20px;
|
||||
margin: 16px 0 10px 0;
|
||||
font-weight: 600;
|
||||
}
|
||||
img{
|
||||
max-width:100%;
|
||||
height:auto;
|
||||
border-radius:4px;
|
||||
margin:12px 0
|
||||
}
|
||||
|
||||
h5 {
|
||||
font-size: 16px;
|
||||
margin: 14px 0 8px 0;
|
||||
font-weight: 600;
|
||||
}
|
||||
table{
|
||||
width:100%;
|
||||
border-collapse:collapse;
|
||||
margin:12px 0
|
||||
}
|
||||
th,td{
|
||||
padding:10px 14px;
|
||||
text-align:left;
|
||||
border-bottom:1px solid rgba(255,255,255,.06)
|
||||
}
|
||||
th{
|
||||
background:#17191b;
|
||||
font-weight:600;
|
||||
color:#f0f6f8
|
||||
}
|
||||
tr:hover{background:rgba(255,255,255,.02)}
|
||||
|
||||
h6 {
|
||||
font-size: 14px;
|
||||
margin: 12px 0 6px 0;
|
||||
font-weight: 600;
|
||||
color: #9aa6b1;
|
||||
}
|
||||
.divider{
|
||||
margin:24px 0;
|
||||
height:1px;
|
||||
background:rgba(255,255,255,.1)
|
||||
}
|
||||
|
||||
ul, ol {
|
||||
margin: 12px 0;
|
||||
padding-left: 24px;
|
||||
}
|
||||
.section{margin-top:32px}
|
||||
|
||||
li {
|
||||
margin: 6px 0;
|
||||
}
|
||||
.links{margin:10px 0}
|
||||
.links a{
|
||||
display:inline-block;
|
||||
margin:0 12px 6px 0
|
||||
}
|
||||
|
||||
code {
|
||||
background: #17191b;
|
||||
border: 1px solid rgba(255, 255, 255, 0.06);
|
||||
padding: 2px 6px;
|
||||
border-radius: 3px;
|
||||
font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace;
|
||||
font-size: 0.9em;
|
||||
color: #cde7ff;
|
||||
}
|
||||
|
||||
pre {
|
||||
background: #17191b;
|
||||
border: 1px solid rgba(255, 255, 255, 0.06);
|
||||
padding: 18px;
|
||||
border-radius: 4px;
|
||||
margin: 12px 0;
|
||||
overflow-x: auto;
|
||||
font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace;
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
pre code {
|
||||
background: none;
|
||||
border: none;
|
||||
padding: 0;
|
||||
font-size: inherit;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
border-left: 3px solid #68a6ff;
|
||||
padding-left: 18px;
|
||||
margin: 12px 0;
|
||||
color: #dfe9ee;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
hr {
|
||||
border: none;
|
||||
border-top: 1px solid rgba(255, 255, 255, 0.1);
|
||||
margin: 24px 0;
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
border-radius: 4px;
|
||||
margin: 12px 0;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin: 12px 0;
|
||||
}
|
||||
|
||||
th, td {
|
||||
padding: 10px 14px;
|
||||
text-align: left;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
|
||||
}
|
||||
|
||||
th {
|
||||
background: #17191b;
|
||||
font-weight: 600;
|
||||
color: #f0f6f8;
|
||||
}
|
||||
|
||||
tr:hover {
|
||||
background: rgba(255, 255, 255, 0.02);
|
||||
}
|
||||
|
||||
.divider {
|
||||
margin: 24px 0;
|
||||
height: 1px;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.section {
|
||||
margin-top: 32px;
|
||||
}
|
||||
|
||||
.links {
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.links a {
|
||||
display: inline-block;
|
||||
margin-right: 12px;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
strong, b {
|
||||
font-weight: 600;
|
||||
color: #f0f6f8;
|
||||
}
|
||||
|
||||
em, i {
|
||||
font-style: italic;
|
||||
}
|
||||
</style>
|
||||
strong,b{font-weight:600;color:#f0f6f8}
|
||||
em,i{font-style:italic}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
@@ -268,44 +213,39 @@ function M:custom(str)
|
||||
return self
|
||||
end
|
||||
|
||||
function M:g(str)
|
||||
self:custom(str)
|
||||
return self
|
||||
end
|
||||
|
||||
function M:h1(str)
|
||||
str = str or ""
|
||||
self:custom("<h1>" .. str .. "</h1>")
|
||||
self:custom(std.h1(str))
|
||||
return self
|
||||
end
|
||||
|
||||
function M:h2(str)
|
||||
str = str or ""
|
||||
self:custom("<h2>" .. str .. "</h2>")
|
||||
self:custom(std.h2(str))
|
||||
return self
|
||||
end
|
||||
|
||||
function M:h3(str)
|
||||
str = str or ""
|
||||
self:custom("<h3>" .. str .. "</h3>")
|
||||
self:custom(std.h3(str))
|
||||
return self
|
||||
end
|
||||
|
||||
function M:h4(str)
|
||||
str = str or ""
|
||||
self:custom("<h4>" .. str .. "</h4>")
|
||||
self:custom(std.h4(str))
|
||||
return self
|
||||
end
|
||||
|
||||
function M:h5(str)
|
||||
str = str or ""
|
||||
self:custom("<h5>" .. str .. "</h5>")
|
||||
self:custom(std.h5(str))
|
||||
return self
|
||||
end
|
||||
|
||||
function M:h6(str)
|
||||
str = str or ""
|
||||
self:custom("<h6>" .. str .. "</h6>")
|
||||
self:custom(std.h6(str))
|
||||
return self
|
||||
end
|
||||
|
||||
@@ -374,12 +314,6 @@ function M:li(str)
|
||||
end
|
||||
|
||||
function M:code(str)
|
||||
str = str or ""
|
||||
self:custom("<code>" .. str .. "</code>")
|
||||
return self
|
||||
end
|
||||
|
||||
function M:pre(str)
|
||||
str = str or ""
|
||||
self:custom("<pre><code>" .. str .. "</code></pre>")
|
||||
return self
|
||||
|
||||
Reference in New Issue
Block a user