azu / gitbook-plugin-include-codeblock

GitBook plugin for including file
Other
40 stars 25 forks source link

Provide way to hardcode class #10

Closed johnlindquist closed 8 years ago

johnlindquist commented 8 years ago

When you import a TypeScript file .ts: The parser correctly finds .ts in the languages.json extensions for both TypeScript and XML, then automatically chooses XML.

Because this is the correct behavior (I'm assuming .ts is a valid extension for XML), the only approach is tell the parser exactly which language you want to be provided to class='lang-typescript'.

Perhaps adding an explicit class as a third param is the solution: [import, hello-world.js, lang-typescript](hello-world.ts)

azu commented 8 years ago

@johnlindquist Thanks for reporting.

Currently, gitbook-plugin-include-codeblock use language-map for detecting lang type by .ext.

Oh, .ts is duplicated.

Perhaps adding an explicit class as a third param is the solution: [import, hello-world.js, lang-typescript](hello-world.ts)

It is possible, I think.

language-map has "aceMode" property for each language.

azu commented 8 years ago

I'm try to implement.

azu commented 8 years ago

I've implemeted suggested feature #11

azu commented 8 years ago

@johnlindquist I've released 1.7.0. Please try it :)

johnlindquist commented 8 years ago

Wow, that was fast :)

Seems to work perfectly. Thanks so much.