highlights_plugin

Dart implementation of highlights KMP engine:
https://github.com/SnipMeDev/Highlights

Installation

flutter pub add highlights_plugin

Usage

final plugin = HighlightsPlugin(debug: true);

// ['kotlin', 'dart', 'swift', 'php', 'java', ...]
final languages = await plugin.getLanguages();
// ['monokai', 'darcula', 'notepad', ...]
final themes = await plugin.getThemes();
// Bold Hello
final emphasis = PhraseLocation(start: 3, length: 8);
// List with ColorHighlight or BoldHighlight  
final result = await plugin.getHighlights(
  '// Hello, World!',
  languages.first,
  themes.first,
  [emphasis],
);

Features

  • 17 supported languages (Kotlin, Dart, Swift, PHP, etc)
  • Light / dark mode
  • 6 built-in themes
  • Phrase bolding (emphasis)
  • Result caching and support for incremental changes

Support

  • Android โœ…
  • iOS โœ…
  • macOS ๐Ÿ”ด (Not yet)
  • Linux ๐Ÿ”ด (Not yet)
  • Windows ๐Ÿ”ด (Not yet)
  • Web ๐Ÿ”ด (Not yet)

License ๐Ÿ–‹๏ธ

Copyright 2024 Tomasz Kฤ…dzioล‚ka.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.