Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ablula/egg-yuque-viewer

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ablula/egg-yuque-viewer

egg plugin for yuque viewer

  • 0.1.9
  • npm
  • Socket score

Version published
Weekly downloads
17
Maintainers
1
Weekly downloads
 
Created
Source

egg-yuque-viewer

功能特性

只需要简单的配置就能够在 web 站点展示语雀文档

配置

配置项类型示例说明
searchString/api/v1/searchsearch route
noHeaderbooltrue隐藏 header
onlyDocbooltrue只展示文件内容,隐藏侧边栏和header
viewString'/help.html'文档页面路由
prefixString'/documents'文档接口路由
titleString帮助文档文档页面 title
logoStringhttps://gw.alipayobjects.com/mdn/prod_resou/afts/img/A*OwZWQ68zSTMAAAAAAAAAAABkARQnAQ文档页面 logo
showSearchStringtrue是否显示搜索框
lazyLoadboolfalse文档页面是否懒加载
showEditorboolfalse是否显示跳转到语雀编辑的 icon
tokenString''语雀 token
darkModebooltrueheader 的 dark/light 模式
lightColorString'#ffffff00'header 的 light 模式 的颜色
blackColorString'black'header 的 dark 模式 的颜色

Examples

plugin.js
exports.yuqueViewer = {
  enable: true,
  package: '@ablula/egg-yuque-viewer',
};
config.default.js
config.yuqueViewer = {
  npm: '@ablula/document-client@0.1.2',
  namespace: 'ant-design/course',
  search: '/documents/search',
  title: 'Ant Design 实战教程',
  prefix: '/documents',
  onlyDoc: false,
  noHeader: false,
  showSearch: true,
  showEditor: false,
  view: '/documents',
  token: '',
  darkMode: true,
  lightColor: '#ffffff00',
  blackColor: 'black',
  logo: 'https://gw.alipayobjects.com/mdn/prod_resou/afts/img/A*OwZWQ68zSTMAAAAAAAAAAABkARQnAQ',
};

使用

直接访问

根据上述配置中的 view 可以直接访问对应页面,例如服务启动的地址为:http://localhost:3333 ,view 配置为 /documents,则文档访问 url 为:http://localhost:3333/documents

方法调用

app.yuqueViewer
await app.yuqueViewer.search('let');

// return 
{
    data: [
        {
            category: "站点文档",
            content: "<p>asdf</p>",
            locator: "/design/doc/7",
            siteId: 1,
            title: "写一个文档"
        },
        {
            category: "站点文档",
            content: "<pre><code>let a=b;</code></pre>",
            locator: "/component/doc/12",
            siteId: 1,
            title: "newdocs"
        }
    ],
    total: 2
}

Keywords

FAQs

Package last updated on 25 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc