Files
Agent-n8n/backups/exhibition-demo-backup-20250928-210916/node_modules/refractor
Yep_Q 67f5dfbe50 feat: 实现多订单班支持系统
主要功能:
- 修改RequirementModal支持12个订单班选择
- 添加OrderClassIconMap图标映射组件
- Store中添加selectedOrderClass状态管理
- WorkflowPage支持传递orderClass参数
- web_result添加URL参数切换功能
- 创建order-class-handler.js动态处理页面主题

技术改进:
- 创建软链接关联订单班数据目录
- 生成wenlu.json和food.json数据结构
- 删除重复的web_result目录
- 添加测试页面test-order-class.html

影响范围:
- 展会策划系统现支持12个订单班
- 结果展示页面自动适配不同订单班主题
- 用户可选择不同行业生成对应方案

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-29 10:02:15 +08:00
..
2025-09-29 10:02:15 +08:00
2025-09-29 10:02:15 +08:00
2025-09-29 10:02:15 +08:00
2025-09-29 10:02:15 +08:00
2025-09-29 10:02:15 +08:00

refractor

Build Coverage Downloads Size

Lightweight, robust, elegant virtual syntax highlighting using Prism. Useful for virtual DOMs and non-HTML things. Perfect for React, VDOM, and others.

refractor is built to work with all syntaxes supported by Prism, thats 277 languages (as of prism@1.27.0) and all themes.

Want to use highlight.js instead? Try lowlight!

Contents

Install

npm:

npm install refractor

Use in the browser »

Use

var refractor = require('refractor')

var nodes = refractor.highlight('"use strict";', 'js')

console.log(nodes)

Yields:

[
  {
    type: 'element',
    tagName: 'span',
    properties: {className: ['token', 'string']},
    children: [{type: 'text', value: '"use strict"'}]
  },
  {
    type: 'element',
    tagName: 'span',
    properties: {className: ['token', 'punctuation']},
    children: [{type: 'text', value: ';'}]
  }
]

Which serialized with rehype or hast-util-to-html yields (you may have to wrap it into a fragment like so: {type: 'root', children: nodes}):

<span class="token string">"use strict"</span><span class="token punctuation">;</span>

Tip

: Use hast-to-hyperscript to transform to other virtual DOMs, or DIY.

API

refractor.register(syntax)

Register a syntax. Needed if youre using refractor/core.

Example
var refractor = require('refractor/core')
var markdown = require('refractor/lang/markdown')

refractor.register(markdown)

console.log(refractor.highlight('*Emphasis*', 'markdown'))

Yields:

[
  {
    type: 'element',
    tagName: 'span',
    properties: {className: [Array]},
    children: [[Object], [Object], [Object]]
  }
]

refractor.alias(name[, alias])

Register a new alias for the name language.

Signatures
  • alias(name, alias|list)
  • alias(aliases)
Parameters
  • name (string) — Name of a registered language
  • alias (string) — New alias for the registered language
  • list (Array.<alias>) — List of aliases
  • aliases (Object.<alias|list>) — Map where each key is a name and each value an alias or a list
Example
var refractor = require('refractor/core')
var markdown = require('refractor/lang/markdown')

refractor.register(markdown)

// refractor.highlight('*Emphasis*', 'mdown')
// ^ would throw: Error: Unknown language: `mdown` is not registered

refractor.alias({markdown: ['mdown', 'mkdn', 'mdwn', 'ron']})
refractor.highlight('*Emphasis*', 'mdown')
// ^ Works!

refractor.highlight(value, language)

Parse value (string) according to the language (name or alias) syntax.

Returns

Virtual nodes representing the highlighted value (Array.<Node>).

Example
var refractor = require('refractor/core')

console.log(refractor.highlight('em { color: red }', 'css'))

Yields:

[
  {
    type: 'element',
    tagName: 'span',
    properties: {className: [Array]},
    children: [[Object]]
  },
  {type: 'text', value: ' '},
  // …
  {type: 'text', value: ' red '},
  {
    type: 'element',
    tagName: 'span',
    properties: {className: [Array]},
    children: [[Object]]
  }
]

refractor.registered(language)

Check if a language (name or alias) is registered.

Example
var refractor = require('refractor/core')
var markdown = require('refractor/lang/markdown')

console.log(refractor.registered('markdown'))

refractor.register(markdown)

console.log(refractor.registered('markdown'))

Yields:

false
true

refractor.listLanguages()

List all registered languages (names and aliases).

Returns

Array.<string>.

Example
var refractor = require('refractor/core')
var markdown = require('refractor/lang/markdown')

console.log(refractor.listLanguages())

refractor.register(markdown)

console.log(refractor.listLanguages())

Yields:

[
  'markup',
  'html',
  // …
  'javascript',
  'js'
]
[
  'markup',
  'html',
  // …
  'javascript',
  'js',
  'markdown',
  'md'
]

Browser

I do not suggest using the pre-bundled files or requiring refractor itself in the browser as that would include a 376kb (139kb GZipped) of code.

Instead require refractor/core and include only the needed syntaxes. For example:

var refractor = require('refractor/core')

refractor.register(require('refractor/lang/jsx'))

console.log(refractor.highlight('<Dropdown primary />', 'jsx'))

Yields:

[
  {
    type: 'element',
    tagName: 'span',
    properties: {className: ['token', 'tag']},
    children: [
      {type: 'element', tagName: 'span', properties: {className: [Array]}, children: [[Object], [Object]]},
      {type: 'text', value: ' '},
      {type: 'element', tagName: 'span', properties: {className: [Array]}, children: [[Object]]},
      {type: 'text', value: ' '},
      {type: 'element', tagName: 'span', properties: {className: [Array]}, children: [[Object]]}
    ]
  }
]

…When using browserify and minifying with tinyify this results in just 65kb of code (23kb with GZip).

Plugins

refractor does not support Prism plugins:

  1. Prism plugins often deal with the DOM, not Prism tokens
  2. Prism is made using global variables instead of a module format, so all syntaxes below are custom built to work so you can require just what you need

Syntaxes

All syntaxes are included if you require('refractor'). If youre using refractor/core, checked syntaxes are always included, but unchecked syntaxes are not and must be required and registered.

Unlike in Prism, cssExtras and phpExtras are camel-cased instead of dash-cased.

Only these custom built syntaxes will work with refractor because Prisms own syntaxes are made to work with global variables and are not requirable.

Projects

License

MIT © Titus Wormer