- The following content uses ==Google Translate==
- This solution is to add Microsoft emojis by adding ==custom emojis== . The whole set has about 10,000 emojis. You can use it as appropriate.
- As usual, the tutorial is given first and then the example, so the pictures are below the steps ====.
- This tutorial is mainly to cooperate with the folder grouping function of Siyuan plug-in: emoji enhancement (siyuan-plugin-emoji-enhance) to automatically group the source files.
First of all, the disadvantages are explained:
- No suitable fluent emoji font has been found for the time being, so this solution cannot replace the built-in emoji of Siyuan.
- There are many and large files, with a total of 10,000+ (four styles in total) and a size of 100MB. Choose and use as appropriate.
Steps
Prerequisites
- Download the compressed file of fluent emoji: GitHub - microsoft/fluentui-emoji: A collection of familiar, friendly, and modern emoji from Microsoft
Green button: Code
--->Download ZIP
- Install
emoji enhancement (siyuan plugin emoji enhance)
in Siyuan - Install
python
https://www.python.org/
Specific steps
- Unzip the downloaded
ZIP
file - Find the unzipped folder
- Create a python file
organize_emoji.py
underFolder path --> assets
- Copy the code to the python file and run it in this folder
- Run the command:
python3 organize_emoji.py
- Code:
import os
import json
import shutil
# 设定当前目录为工作目录
root_dir = '.'
# 功能:递归遍历文件夹,寻找最底层的目录
def move_files_and_remove_dir(path, group):
# 判断是否是最底层目录
if all(os.path.isdir(os.path.join(path, x)) for x in os.listdir(path)):
for dir_name in os.listdir(path):
# 递归调用处理下一层目录
move_files_and_remove_dir(os.path.join(path, dir_name), group)
else:
# 移动文件到目标目录
target_folder = os.path.join(root_dir, f"{group}_{os.path.basename(path)}")
os.makedirs(target_folder, exist_ok=True)
for file in os.listdir(path):
src_file = os.path.join(path, file)
dst_file = os.path.join(target_folder, file)
shutil.move(src_file, dst_file)
# 检查是否可以删除原目录
if not os.listdir(path):
os.rmdir(path)
# 遍历所有顶级文件夹
for emoji_folder in os.listdir(root_dir):
emoji_path = os.path.join(root_dir, emoji_folder)
if os.path.isdir(emoji_path) and 'metadata.json' in os.listdir(emoji_path):
metadata_path = os.path.join(emoji_path, 'metadata.json')
# 读取metadata.json获取group信息
with open(metadata_path, 'r', encoding='utf-8') as f:
data = json.load(f)
group = data.get('group')
# 处理此emoji文件夹下的所有文件
for item in os.listdir(emoji_path):
item_path = os.path.join(emoji_path, item)
if os.path.isdir(item_path):
move_files_and_remove_dir(item_path, group)
# 删除原emoji目录
shutil.rmtree(emoji_path, ignore_errors=True)
# 打印完成信息
print("文件已按照分组信息和风格分类。原文件夹已删除。")
- To be safe, close SourceScript, and then copy
all folders in assets
to the bottom ofSourceScript's emojis folder
- Open SourceScript
-
By the way, here is a CSS snippet to fix the emoji enhanced grouping column
.emojis>.fn__flex { overflow-x: scroll; }
Introduction
Microsoft fluent is divided into four styles:
- 3D: PNG format, good effect
- Colorful Color: SVG format, three-dimensional icons with effects that are somewhat different from 3D
- Flat Flat: SVG format, flat icons
- High Contrast (black and white): SVG format, black and white icons
Style of plug-ins combined in SourceScript
You can see that the bottom is grouped by default type and style.
Welcome to here!
Here we can learn from each other how to use SiYuan, give feedback and suggestions, and build SiYuan together.
Signup About