Skip to content

Add YAML syntax highlighting #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ebkalderon opened this issue Feb 9, 2016 · 5 comments
Closed

Add YAML syntax highlighting #103

ebkalderon opened this issue Feb 9, 2016 · 5 comments

Comments

@ebkalderon
Copy link

It seems that with highlightjs/highlight.js#119, the Highlight.js library now supports syntax highlighting for YAML. However, when I annotate some YAML with ````yaml`, no syntax highlighting appears.

@ebkalderon ebkalderon changed the title Add YAML support Add YAML syntax highlighting Feb 10, 2016
@ebkalderon
Copy link
Author

@azerupi Could you perhaps explain why this is happening? Does mdBook use an older version of Highlight.js that lacks YAML support for syntax highlighting?

@azerupi
Copy link
Contributor

azerupi commented Feb 10, 2016

Yes, I haven't updates highlight.js since August, I think.

I am rewriting mdBook to have a sort of plugin api and will extract the
code that manages the syntax highlighting into a more isolated plugin. When
that is done I will probably switch to a dependency manager like Bower to
update dependencies on a regular basis.

Also I have disabled auto-detect, because in my experience it doesn't
always work like it is supposed too. When it's a plugin I will probably add
an option in the config file to indicate a default language.

But.. at the moment I am on vacation ;)
On Feb 10, 2016 3:53 PM, "Eyal Kalderon" [email protected] wrote:

@azerupi https://github.com/azerupi Could you perhaps explain why this
is happening? Does mdBook use an older version of Highlight.js for syntax
highlighting?


Reply to this email directly or view it on GitHub
https://github.com/azerupi/mdBook/issues/103#issuecomment-182406368.

@ebkalderon
Copy link
Author

@azerupi Sounds good. Until then, please relax and enjoy your vacation!

@Luthaf
Copy link

Luthaf commented Feb 15, 2016

YAML support is not activated by default in highlight.js code. As a temporary workaround, you could download highlight.js (Custom package section) from there website, activating all the languages you need, and then putting the file in src/theme/highlight.js.

@azerupi
Copy link
Contributor

azerupi commented Feb 16, 2016

Yes, @ebkalderon you can do like @Luthaf suggests until I update the in tree version. You can read more about the process of overriding default theme files in the documentation.

If you do, let me know if it fixes the issue

@azerupi azerupi added this to the 0.1.0 milestone Feb 16, 2016
@azerupi azerupi closed this as completed Nov 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants