跳至主要內容

LincZero大约 5 分钟

ob library,please use Obsidian install AnyBlock plugin and open this sample You may need to switch between source/live/render modes frequently. Personal shortcuts are recommended:

  • Ctrl + / | Switch source and real-time(Default not set)
  • Alt + / | Toggle edit and render(Default Ctrl+E)

Plug-in recommended Settings:(Default)

Introduce

A Obsidian Plugin —— AnyBlock(It may be shortened to AB). You can flexibility to create a 'Block' by some means. It also provides some useful features, like list to table.

The plug-in consists of two core parts: the selector and the processor. A selector can select an area of text and turn it into a "block." The processor can convert the selector into a "block" for some degree of reprocessing.

Selector

Selectors include

  • list selector
    • Usage: Add the header for [processor name] one or two lines above the list, noting that the header must be at the same level as the first line in the list
  • quote selector
    • Usage: Add the header for [processor name] one or two lines above the quote block, noting that the header must be at the same level as the first line in the quote block
  • code selector (pre selector)
    • Usage: Add the header for [processor name] one or two lines above the code block, noting that the header must be at the same level as the first line in the code block
  • title selector (heading selector)
    • Usage: Add the header for [processor name] one or two lines above the title, noting that the header must be at the same level as the first line in the title
    • Note: The selection may span what Obsidian considers "minimum blocks" and may be invalidated by Obsidian optimization in render mode
  • head-tail selector
    • Use: to start and end with :::, with the processor name written after the first :::, without adding []. Just like code blocks, this is an md extension syntax for VuePress
    • Note: The selection may span what Obsidian considers "minimum blocks" and may be invalidated by Obsidian optimization in render mode

Selector overview

Here's an example: (@todo nested rendering is a bit buggy at the moment). You can also view all the selectors supported by the current version of the plugin through the Settings panel. %% 下面举例使用:(@todo 嵌套渲染目前还有点bug)%% %% 你也可以通过设置面板来查看当前版本插件所支持的所有选择器 %%

[title2list|list2tab]

List Selector

- 1
	- 2
		- 3
	- 4

Quote Selector

> 1
> > 2
> 
> 3

Code Selector

~~~
1
2
3
~~~

Title Selector

A TAB bar like this is done using this selector %%像这里的转标签栏,就是使用标题选择器完成的%%

Head-tail Selector

This selector is not available in render mode %%该选择器在渲染模式不可用%%

:::code() 1 2 3 :::

Table Selector

add in V2.2.0

|1  |2  | 
|---|---|
|3  |4  |

Nested support

  • Starting at v2.0.0, support for AB statements in lists or reference blocks (not restricted to use only at the root of the document)
  • Starting at v2.1.0, can support the use of AB block including AB block itself (@todo depends on html2md, bug probability is larger)

[title2list|list2tab]

List in Quote

1 2

- 11
	- 12
		- 13
	- 14

3 4

Quote in List

l1

1
2

l2

List in List

Or even three levels of nesting %%甚至三层嵌套%%

1

2

3

ll1

ll2

ll3

ll4

5

Quote in Quote

q in q

1 2

> c1()
> c2()

3

~~Advanced selector(underdevelopment) ~~

%%高级选择器(未开发)%%

[>XXX] 可以缩减范围选择(此功能未开发) {^XXX} 所在层级选择,不同于下一层级选择(此功能未开发)

Processor

Processor includes

render processor

text to element

This includes parsing operations, which are actually more accurately called "parse and render" If no render operation is specified, it is an md render operation

text processor

text to text

Text-only processing, that is, converting a series of plain text into another new plain text that can be superimposed

decorate processor

element to element

Some decorations can be provided: overflow scrolling, etc. stackable

[title(Note)]

  1. The processor can carry out multiple processing USES | intervals. A processor can consist of multiple text operations and multiple decoration operations, plus a render operation
  2. The decorator is new to v1.3.0. Compared to the previous version, the decorator is more flexible and can make secondary changes to the already formed page elements
  3. If the decorator is used directly on the text processor, an md rendering processor is automatically applied to the text first by default
  4. The logic of three processors,as shown below [list2mermaid]
    • Text--TextProcessor-->Text
    • Text--RenderProcessor-->UI
    • UI--DecorateProcessor-->UI

Processor overview

(The following may contain old or unimplemented or incompatible versions of the plug-in, or you may use the Settings panel to see all the processors supported by the plug-in you installed)

**You can also view all processors supported by the current version of the plugin through the Settings panel **

Type

Analytic Method

解析方法

Rendering Method

渲染方法

can turn md/html?

tree

ul-list

ul树 (一叉多层树)

2ut/2mdut

转表格(规范)

md/html

li-list

li树 (一叉多层树)

2lt/mdlt

转列表格

html

ab-tree

二层树 也叫 "消除最高级" (一叉二层树)

2timeline

转时间线

mermaid

2tab

转标签栏

html

2chat

转对话

tree-list

树列表 (多叉多层树)

2table/2mdtable

转树表格

html

2mermaid

转流程图

mermaid/html

2mindmap

转思维导图

html

2tree

长得像树的树状图

html

2xuri

旭日图

html

2brace

括弧分类图

html

other

title

标题级(语法糖)

2list+list2xxx

(组合使用,下面提供了几种语法糖)

2tab

2table

2mindmap

code

一定代码

2doctable

转表格(文档生成)

html

json

这个不能转树,只能说转可折叠渲染

common

通用

text

纯文本

md

md

md渲染

md

render

渲染 (理论上为 "渲染修饰器" 但该功能没做)

flod

(折叠类)可折叠

md+

hide

(折叠类)默认折叠

md+

heimu

(折叠类)黑幕遮挡

html

limit()/part()

(折叠类)限高折叠

html

scroll()

(折叠类)限高滚动

html

title()

增加块标题(代码块可能会很常用)

展开

Supported text processor:

Type

类型

processor

处理器

title

标题类

title2list

转列表文本,title最重要的处理器,可配合list渲染器使用

tree-indent

树缩进

indent2list

缩进转列表

code/quote

代码或引用块

X

根据选择器自动解除块

code/code(str)

变代码块

Xcode/Xcode(bool)

解除代码块

quote

变引用块

Xquote

解除引用块

code2quote

代码块转引用块

quote2code

引用块转代码块

text

纯文本操作

replace

替换(带参)

slice()

切片(例如切割1,-1,也可以达到类似Xcode的效果)

listroot

增加列表根

2tree-indent

列表转缩进

三种可解析为树的选择器的差异 [2table]

  • < 选择器| 可解析层次| 在ul-list里解析的区别
  • 列表选择器| 树层次(>0)| 首列仅解析列表层,|为分割
  • 负列表选择器| 树层级(>-4)| 首列仅解析负列表层
  • 标题选择器| 树层级(>-9)| 首列仅解析标题层

补充:

  • 2 表示 to 的意思(就是一种格式转化为另一种格式)
  • X 表示 去除 的意思(例如去除引用块或代码块)