1C (BSL) Language Support

by Sanal Tserenov
5
4
3
2
1
Score: 50/100

Description

1C (BSL) Syntax Support for Obsidian

Reviews

No reviews yet.

Stats

0
stars
106
downloads
0
forks
17
days
5
days
5
days
0
total PRs
0
open PRs
0
closed PRs
0
merged PRs
0
total issues
0
open issues
0
closed issues
15
commits

Latest Version

6 days ago

Changelog

What's fixed

Reading-mode syntax highlighting was lost after restarting Obsidian: at startup the reading-view DOM is populated after the plugin's initial highlight pass, and switching between reading and editing does not recreate the preview — so blocks stayed unhighlighted until the plugin was toggled off and on.

The highlight pass now repeats with delays after workspace load and also runs on every layout change, so highlighting restores itself within a couple of seconds after start and on any note or mode switch.

Full Changelog: https://github.com/Sanal/obsidian-onec-syntax-highlight/compare/1.0.6...1.0.7

README file from

Github

1C (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 (Массив, Структура, Запрос…);
  • Истина, Ложь, Неопределено, Null literals;
  • 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

  1. Download main.js and manifest.json from the latest GitHub release.
  2. Place both files into a folder named onec-syntax-highlight inside your vault: <vault>/.obsidian/plugins/onec-syntax-highlight/
  3. In Obsidian, open Settings → Community plugins:
    • if Restricted Mode is enabled — turn it off;
    • enable 1C (BSL) Language Support in the list.
  4. If the plugin does not appear in the list — restart Obsidian.
  5. 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.