Skip to content

Need option to disable the default hidelines feature for rust #2881

@zgtm

Description

@zgtm

Problem

In https://opengl.zgtm.eu/chapter_3.html I have Rust code, that contains multiline strings, which themselves contain C code (OpenGL shader).

E.g.:

const VERTEX_SHADER_SOURCE: &CStr = c"
#version 410 core

in vec3 position;

void main() {
    gl_Position = vec4(position, 1.0f);
}
";

I want syntax coloring, so I declared the code as rust (```rust). However, as the embedded C code in the string contains lines beginning with #, I need a way to disable the default behaviour of mdBook to hide all lines that begin with a `#`.

Proposed Solution

I propose to add a new config option default-hidelines under output.html.code that is "true" by default, but can be set to "false" if one wishes to disable the default behaviour:

[output.html.code]
default-hidelines = false

I have written a PR that implements this solution in #2518 .

Notes

Since I use the {{#include ..}}-helper of mdBook to include the code from the actual source files, I cannot use the workaround of using a double ##, that was proposed in #2518.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: Enhancement or feature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions