Skip to content

Default language for code tag #370

Open
@Songbird0

Description

@Songbird0

Hi,

Basic code tag (without language name specified) is not supported by markdown interpreter when I put a piece of Rust code.

I tried this code:

(No language name specified in code tag)

|val| val + x

I expected to see this happen: No error thrown by mdbook test.

Instead, this happened: mdbook test throws an error.

Meta

Backtrace:

An error occured:

running 2 tests

test /home/travis/build/Songbird0/FR_RBE/src/chapitre8/closures.md - Les_closures (line 5) ... FAILED

test /home/travis/build/Songbird0/FR_RBE/src/chapitre8/closures.md - Les_closures (line 5) ... FAILED

failures:

---- /home/travis/build/Songbird0/FR_RBE/src/chapitre8/closures.md - Les_closures (line 5) stdout ----

	error[E0425]: cannot find value `x` in this scope

 --> <anon>:2:13

  |

2 | |val| val + x

  |             ^ not found in this scope

error[E0308]: mismatched types

 --> <anon>:2:1

  |

2 | |val| val + x

  | ^^^^^^^^^^^^^ expected (), found closure

  |

  = note: expected type `()`

             found type `[closure@<anon>:2:1: 2:14]`

error: aborting due to previous error(s)

You should "skip" code compilation when language name isn't specified in markdown code tag, maybe ? So:

(Specified language name: rust)

|val| var + x 

Ok !

(Specified language name: nothing, text by default)

|val| var + x

Compilation skipped, not enough information to test code tag content.

See here(my travis backtrace) for more.

Solution

I've added text language name in code tag to skip this test.

|val| val + x

Works properly.

Regards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-HighlightingArea: Code colored syntax highlightingA-TestsArea: `mbdook test` related testsC-papercutCategory: A small usability bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions