Skip to content

Commit

Permalink
📚 Merge penpot/penpot-docs repository
Browse files Browse the repository at this point in the history
  • Loading branch information
bameda authored and niwinz committed Oct 30, 2024
1 parent 3932054 commit 8829648
Show file tree
Hide file tree
Showing 665 changed files with 17,621 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
144 changes: 144 additions & 0 deletions docs/.eleventy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
const { DateTime } = require("luxon");
const fs = require("fs");
const pluginNavigation = require("@11ty/eleventy-navigation");
const pluginRss = require("@11ty/eleventy-plugin-rss");
const pluginSyntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
const pluginAncestry = require("@tigersway/eleventy-plugin-ancestry");
const metagen = require('eleventy-plugin-metagen');
const pluginTOC = require('eleventy-plugin-nesting-toc');
const markdownIt = require("markdown-it");
const markdownItAnchor = require("markdown-it-anchor");
const markdownItPlantUML = require("markdown-it-plantuml");
const elasticlunr = require("elasticlunr");


module.exports = function(eleventyConfig) {
eleventyConfig.addPlugin(pluginNavigation);
eleventyConfig.addPlugin(pluginRss);
eleventyConfig.addPlugin(pluginSyntaxHighlight);
eleventyConfig.addPlugin(pluginAncestry);
eleventyConfig.addPlugin(metagen);
eleventyConfig.addPlugin(pluginTOC, {
tags: ['h1', 'h2', 'h3']
});

eleventyConfig.setDataDeepMerge(true);

eleventyConfig.addLayoutAlias("post", "layouts/post.njk");

eleventyConfig.addFilter("readableDate", dateObj => {
return DateTime.fromJSDate(dateObj, {zone: 'utc'}).toFormat("dd LLL yyyy");
});

// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-date-string
eleventyConfig.addFilter('htmlDateString', (dateObj) => {
return DateTime.fromJSDate(dateObj, {zone: 'utc'}).toFormat('yyyy-LL-dd');
});

// Remove trailing # in automatic generated toc, because of
// anchors added at the end of the titles.
eleventyConfig.addFilter('stripHash', (toc) => {
return toc.replace(/ #\<\/a\>/g, "</a>");
});

// Get the first `n` elements of a collection.
eleventyConfig.addFilter("head", (array, n) => {
if( n < 0 ) {
return array.slice(n);
}

return array.slice(0, n);
});

// Get the lowest in a list of numbers.
eleventyConfig.addFilter("min", (...numbers) => {
return Math.min.apply(null, numbers);
});

// Build a search index
eleventyConfig.addFilter("search", (collection) => {
// What fields we'd like our index to consist of
// TODO: remove html tags from content
var index = elasticlunr(function () {
this.addField("title");
this.addField("content");
this.setRef("id");
});

// loop through each page and add it to the index
collection.forEach((page) => {
index.addDoc({
id: page.url,
title: page.template.frontMatter.data.title,
content: page.template.frontMatter.content,
});
});

return index.toJSON();
});

eleventyConfig.addPassthroughCopy("img");
eleventyConfig.addPassthroughCopy("css");
eleventyConfig.addPassthroughCopy("js");

/* Markdown Overrides */
let markdownLibrary = markdownIt({
html: true,
breaks: false,
linkify: true
}).use(markdownItAnchor, {
permalink: true,
permalinkClass: "direct-link",
permalinkSymbol: "#"
}).use(markdownItPlantUML, {
});
eleventyConfig.setLibrary("md", markdownLibrary);

// Browsersync Overrides
eleventyConfig.setBrowserSyncConfig({
callbacks: {
ready: function(err, browserSync) {
const content_404 = fs.readFileSync('_dist/404.html');

browserSync.addMiddleware("*", (req, res) => {
// Provides the 404 content without redirect.
res.write(content_404);
res.end();
});
},
},
ui: false,
ghostMode: false
});

return {
templateFormats: [
"md",
"njk",
"html",
"liquid"
],

// If your site lives in a different subdirectory, change this.
// Leading or trailing slashes are all normalized away, so don’t worry about those.

// If you don’t have a subdirectory, use "" or "/" (they do the same thing)
// This is only used for link URLs (it does not affect your file structure)
// Best paired with the `url` filter: https://www.11ty.dev/docs/filters/url/

// You can also pass this in on the command line using `--pathprefix`
// pathPrefix: "/",

markdownTemplateEngine: "liquid",
htmlTemplateEngine: "njk",
dataTemplateEngine: "njk",

// These are all optional, defaults are shown:
dir: {
input: ".",
includes: "_includes",
data: "_data",
output: "_dist"
}
};
};
1 change: 1 addition & 0 deletions docs/.eleventyignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
README.md
118 changes: 118 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# Distribution files
_dist/*

# yarn
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions


# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port
.idea
1 change: 1 addition & 0 deletions docs/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20.11.1
5 changes: 5 additions & 0 deletions docs/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"editor.rulers": [
80
]
}
11 changes: 11 additions & 0 deletions docs/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
enableGlobalCache: true

enableImmutableCache: false

enableImmutableInstalls: false

enableTelemetry: false

httpTimeout: 600000

nodeLinker: node-modules
17 changes: 17 additions & 0 deletions docs/404.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
layout: layouts/home.njk
permalink: 404.html
eleventyExcludeFromCollections: true
---
# Content not found.

Go <a href="{{ '/' | url }}">home</a>.

{% comment %}
Read more: https://www.11ty.dev/docs/quicktips/not-found/

This will work for both GitHub pages and Netlify:

* https://help.github.com/articles/creating-a-custom-404-page-for-your-github-pages-site/
* https://www.netlify.com/docs/redirects/#custom-404
{% endcomment %}
38 changes: 38 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Penpot Docs

Penpot documentation website.

## Usage

To view this site locally, first set up the environment:

```sh
# only if necessary
nvm install
nvm use
# only if necessary
corepack enable

yarn install
```

And launch a development server:

```sh
yarn start
```

You can then point a browser to [http://localhost:8080](http://localhost:8080).

## Tooling

* [Eleventy (11ty)](https://www.11ty.dev/docs)
* [Diagrams](https://github.com/gmunguia/markdown-it-plantuml) with
[plantuml](https://plantuml.com). See also
[real-world-plantuml](https://real-world-plantuml.com).
* [Diagrams](https://github.com/agoose77/markdown-it-diagrams) with
[svgbob](https://github.com/ivanceras/svgbob) and
[mermaid](https://github.com/mermaid-js/mermaid).
* [arc42](https://arc42.org/overview) template.
* [c4model](https://c4model.com) for software architecture, and an
[implementation in plantuml](https://github.com/plantuml-stdlib/C4-PlantUML).
21 changes: 21 additions & 0 deletions docs/_data/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"title": "Help center",
"url": "https://docs.penpot.app/",
"description": "Design freedom for teams.",
"feed": {
"subtitle": "Penpot: design freedom for teams.",
"filename": "feed.xml",
"path": "/feed/feed.xml",
"id": "https://docs.penpot.app/"
},
"jsonfeed": {
"path": "/feed/feed.json",
"url": "https://docs.penpot.app/feed/feed.json"
},
"author": {
"name": "Penpot",
"email": "hello@penpot.app",
"url": "https://penpot.app"
},
"twitter": "@penpotapp"
}
Loading

0 comments on commit 8829648

Please sign in to comment.