README file from
Github1C (BSL) Language Support
[!WARNING] This plugin was created with the help of AI and has not been thoroughly reviewed or tested. It is still a work in progress and may contain bugs. Use it at your own risk, and please report any issues you find.
Syntax highlighting for the 1C:Enterprise built-in language (BSL) in Obsidian code blocks — both in reading mode and in the editor.
Supported tags
1c in any letter case, Cyrillic or Latin. The bsl and os (OneScript) tags are also supported.
Features
- keywords in Russian and English (
Если/If,КонецЕсли/EndIf,Асинх/Async,Ждать/Await, etc.); - global context methods (
Сообщить,СтрДлина,Окр,ТекущаяДата,ЗначениеЗаполнено…) and platform types (Массив,Структура,Запрос…); Истина,Ложь,Неопределено,Nullliterals;- strings, including multiline ones with
|continuation and""escaping; - date literals
'20240101', numbers,//and/* … */comments; - preprocessor directives (
#Если Сервер Тогда,#Область) and annotations (&НаСервере,&Перед("Имя")); - procedure and function names are highlighted at declaration, along with their parameters;
- operators (
=,+,*, comparisons,И/Или/Не…) and punctuation; - the token model matches the reference 1c-syntax grammar, in both reading and editing modes.
Installation
From the community plugin directory
Open Settings → Community plugins → Browse, search for "1C", then install and enable 1C (BSL) Language Support.
Manual installation
- Download
main.jsandmanifest.jsonfrom the latest GitHub release. - Place both files into a folder named
onec-syntax-highlightinside your vault:<vault>/.obsidian/plugins/onec-syntax-highlight/ - In Obsidian, open Settings → Community plugins:
- if Restricted Mode is enabled — turn it off;
- enable 1C (BSL) Language Support in the list.
- If the plugin does not appear in the list — restart Obsidian.
- Notes that were open before enabling the plugin may not highlight immediately — reopen them.
Quick check
Paste into a note:
```1c
Процедура Приветствие(Имя = "Мир") Экспорт
Если Не ЗначениеЗаполнено(Имя) Тогда
Имя = "мир";
КонецЕсли;
Сообщить(СтрШаблон("Привет, %1!", Имя)); // комментарий
КонецПроцедуры
```
Building from source
Requires Node.js 18+:
npm install
npm run build
main.js is a build artifact and is not committed to the repository — the build produces it in the project root. Copy it together with manifest.json into <vault>/.obsidian/plugins/onec-syntax-highlight/ (see the steps above).
Credits
The keyword and built-in function lists are based on the 1C language definitions from highlight.js (BSD-3-Clause) and Prism (MIT).
License: MIT.