pygments 0.1.3

  • Readme
  • Changelog
  • Installing
  • 0

pygments #

Highlight source code snippets in your HTML files using pygments.

Usage: #

In pubspec.yaml:

dependencies:
  pygments: any

transformers:
  - pygments:
      # Here we define all the HTML elements pygments will run on
      classes:
        # First comes the DOM selector. This will match all *pre* elements that contain a class
        # starting with *language*. For instance, this will match <pre class="language-python">.
        # Note that these are just 100% standard DOM selectors!!
        # Also note that an outer code tag will be stripped. e.g. given
        # <pre class="langauge-python"><code>def main: return 0</code></pre>, the transformer will
        # automatically lift out the *def main: return 0* and only highlight that, ignoring the
        # outer code tag.
        - "pre[class|='language']":
            # Now we need to define the source language. You can do this using a regex as shown
            # below. This will match the language-* class and extract just the language name
            # (e.g. language-dart -> dart).
            re: "language-(.*)"
            # By default, pygments will automatically unescape any HTML escape codes. For example,
            # <pre>a &gt; b</pre> will be converted to *a > b*. Set unescape to false to disable
            # this.
            unescape: false
        # Here's another example. This will run only on elements like <pre class="dart"></pre>.
        - "pre[class=dart]":
            # If your language is constant, you don't need to use a regex. Just use the lang
            # property instead:
            lang: dart
        # Last example! This is for CSS:
        - "pre[class=css]":
            # In the cases where you aren't passing any other options, the default option will
            # be *lang*. So something like:
            # - "pre[class=dart]":
            #     lang: dart
            # can be shortened to:
            # - "pre[class=dart]": dart
            css

development #

(No changes.)

version 0.1.3 #

Fix UTF8 issues.

version 0.1.2 #

Fix a crash when a language class can't be found.

version 0.1.1 #

Initial version (I screwed up version 0.1).

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  pygments: ^0.1.3

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:pygments/pygments.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
--
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
--
Overall:
Weighted score of the above. [more]
0
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://dart.dev/dart-2#migration.

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

Dependencies were not resolved.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.0 <2.0.0