Skip to content

Commit

Permalink
Merge pull request #2 from summerain0/main
Browse files Browse the repository at this point in the history
init document
  • Loading branch information
Rosemoe authored Feb 11, 2024
2 parents 3d82b94 + 76dc53a commit fc63e54
Show file tree
Hide file tree
Showing 14 changed files with 2,599 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Deploy document to Pages

on:
push:
branches: [main]

workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: false

jobs:
build:

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm

- name: Setup Pages
uses: actions/configure-pages@v4

- name: Install dependencies
run: npm ci

- name: Build with VitePress
run: |
npm run build
touch .vitepress/dist/.nojekyll
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: .vitepress/dist

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.vitepress/cache
.vitepress/dist
node_modules
81 changes: 81 additions & 0 deletions .vitepress/config/en.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import config from '../../package.json'
import { defineConfig, type DefaultTheme } from 'vitepress'


export const en = defineConfig({
lang: 'en-US',
description: 'sora-editor is a cool and optimized code editor on Android platform',

themeConfig: {
nav: nav(),

sidebar: {
'/reference/': { base: '/reference/', items: sidebarReference() },
'/guide/': { base: '/guide/', items: guideReference() }
},

editLink: {
pattern: 'https://github.com/project-sora/sora-editor-docs/edit/main/docs/:path',
text: 'Edit this page on GitHub'
},

footer: {
message: 'Released under the LGPL-2.1 License.',
copyright: `Copyright © 2020-${new Date().getFullYear()} Rosemoe`
}
}
})

function nav(): DefaultTheme.NavItem[] {
return [
{
text: 'Guide',
link: '/guide/getting-started',
activeMatch: '/guide/'
},
{
text: 'Reference',
link: '/reference/no-implemention',
activeMatch: '/reference/'
},
{
text: config.version,
items: [
{
text: 'Changelog',
link: 'https://github.com/Rosemoe/sora-editor/releases'
},
{
text: 'Contributing',
link: 'https://github.com/Rosemoe/sora-editor/graphs/contributors'
}
]
}
]
}

function guideReference(): DefaultTheme.SidebarItem[] {
return [
{
items: [
{
text: 'Getting started',
link: '/getting-started'
}
]
}
]
}

function sidebarReference(): DefaultTheme.SidebarItem[] {
return [
{
items: [
{
text: 'No implemention',
link: '/no-implemention'
}
]
}
]
}
12 changes: 12 additions & 0 deletions .vitepress/config/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { defineConfig } from 'vitepress'
import { shared } from './shared'
import { en } from './en'
import { zh } from './zh'

export default defineConfig({
...shared,
locales: {
root: { label: 'English', ...en },
zh: { label: '简体中文', ...zh }
}
})
19 changes: 19 additions & 0 deletions .vitepress/config/shared.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { defineConfig } from 'vitepress'

export const shared = defineConfig({
title: 'Sora Editor',

ignoreDeadLinks: true,
lastUpdated: true,
cleanUrls: true,

themeConfig: {
socialLinks: [
{ icon: 'github', link: 'https://github.com/Rosemoe/sora-editor' }
],

search: {
provider: 'local'
}
}
})
104 changes: 104 additions & 0 deletions .vitepress/config/zh.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
import config from '../../package.json'
import { defineConfig, type DefaultTheme } from 'vitepress'

export const zh = defineConfig({
lang: 'zh-Hans',
description: 'sora-editor是一款高效的安卓代码编辑器',

themeConfig: {
nav: nav(),

sidebar: {
'/zh/reference/': { base: '/zh/reference/', items: sidebarReference() },
'/zh/guide/': { base: '/zh/guide/', items: guideReference() }
},

editLink: {
pattern: 'https://github.com/project-sora/sora-editor-docs/edit/main/docs/:path',
text: '在 GitHub 上编辑此页面'
},

footer: {
message: '基于 LGPL-2.1 许可发布',
copyright: `版权所有 © 2020-${new Date().getFullYear()} Rosemoe`
},

docFooter: {
prev: '上一页',
next: '下一页'
},

outline: {
label: '页面导航'
},

lastUpdated: {
text: '最后更新于',
formatOptions: {
dateStyle: 'short',
timeStyle: 'medium'
}
},

langMenuLabel: '多语言',
returnToTopLabel: '回到顶部',
sidebarMenuLabel: '菜单',
darkModeSwitchLabel: '主题',
lightModeSwitchTitle: '切换到浅色模式',
darkModeSwitchTitle: '切换到深色模式'
}
})

function nav(): DefaultTheme.NavItem[] {
return [
{
text: '指南',
link: '/zh/guide/getting-started',
activeMatch: '/zh/guide/'
},
{
text: '参考',
link: '/zh/reference/no-implemention',
activeMatch: '/zh/reference/'
},
{
text: config.version,
items: [
{
text: '更新日志',
link: 'https://github.com/Rosemoe/sora-editor/releases'
},
{
text: '参与贡献',
link: 'https://github.com/Rosemoe/sora-editor/graphs/contributors'
}
]
}
]
}

function guideReference(): DefaultTheme.SidebarItem[] {
return [
{
items: [
{
text: '快速开始',
link: '/getting-started'
}
]
}
]
}

function sidebarReference(): DefaultTheme.SidebarItem[] {
return [
{
items: [
{
text: '未实现',
link: '/no-implemention'
}
]
}
]
}
33 changes: 33 additions & 0 deletions guide/getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Get started

Add to your app's dependencies:

[![Maven Central](https://img.shields.io/maven-central/v/io.github.Rosemoe.sora-editor/editor.svg?label=Maven%20Central)]((https://search.maven.org/search?q=io.github.Rosemoe.sora-editor%20editor))

```groovy
dependencies {
implementation(platform("io.github.Rosemoe.sora-editor:bom:<versionName>"))
implementation("io.github.Rosemoe.sora-editor:<moduleName>")
}
```

## 🛠️Available modules:

| Module | Summary |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| editor | Widget library containing all basic things of the framework |
| editor-lsp | A convenient library for creating languages by using Language Server Protocol (aka LSP) |
| language-java | A simple implementation for Java highlighting and identifier auto-completion |
| language-textmate | An advanced highlighter for the editor. You can find textmate language bundles and themes and load them by using this module. The internal implementation of textmate is from[tm4e](https://github.com/eclipse/tm4e)|
| language-treesitter | Offer [tree-sitter](https://tree-sitter.github.io/tree-sitter/) support for editor. This can be used to parse the code to an AST fast and incrementally, which is helpful for accurate highlighting and providing completions. Note that this module only provides incremental paring and highlighting. Thanks to Java bindings [android-tree-sitter](https://github.com/AndroidIDEOfficial/android-tree-sitter/) |

Check the newest version from the badge above or [Releases](https://github.com/Rosemoe/CodeEditor/releases).

## Init your project

```xml
<io.github.rosemoe.sora.widget.CodeEditor
android:id="@+id/editor"
android:layout_width="match_parent"
android:layout_height="match_parent" />
```
17 changes: 17 additions & 0 deletions index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
layout: home

title: Sora Editor
titleTemplate: a cool and optimized code editor on Android platform

hero:
name: Sora Editor
tagline: A cool and optimized code editor on Android platform
actions:
- theme: brand
text: Get Started
link: /guide/getting-started
- theme: alt
text: View on GitHub
link: https://github.com/Rosemoe/sora-editor
---
Loading

0 comments on commit fc63e54

Please sign in to comment.