lask79 / antora-shiki-extension

Antora extension to use shiki as syntax highlighter
Mozilla Public License 2.0
4 stars 0 forks source link

Loses formatting when using wrong language id #2

Open cpfeiffer opened 6 months ago

cpfeiffer commented 6 months ago

Consider a code block like this:

[,protobuf]
----
//
// foo.proto
//
// Copyright (C) 2024
// Foo Corp.
// All rights reserved.
//

syntax = "proto3";

import "com/foo/api/v1/datatypes/some.proto";
import "com/foo/api/v1/datatypes/other.proto";

package com.foo.service.api.v1.service;

service FooService {
  // Performs a foo calculation.
  rpc CalculateFoo (FooRequest) returns (FooResponse);
}
// ...

With highlightjs, the rendered code block looks OK, even though it does not have any syntax highlighting.

With shiki, the rendered block is mangled, all newlines and indentation is gone. This is because the language id in shiki is not protobuf, but proto.

So I'm asking if it's possible to at least keep the formatting in case the specified language is not recognized, to keep it readable. Even better, if one could configure aliases for existing languages (without completely registering them anew).

To be fair, an error is reported:

(asciidoctor): No language registration for protobuf