Skip to content

[Website] Bad syntax highlighting #4029

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
iamdto opened this issue Jul 16, 2014 · 10 comments
Closed

[Website] Bad syntax highlighting #4029

iamdto opened this issue Jul 16, 2014 · 10 comments

Comments

@iamdto
Copy link
Contributor

iamdto commented Jul 16, 2014

It looks like syntax highlighting is broken on some code blocks. For example on the framework full default configuration. I've noticed this in some blog posts too (the first Monolog configuration block for example).

Not sure if it's a bug or a feature, though.

@stof
Copy link
Member

stof commented Jul 16, 2014

This is because we have some unquoted values starting with %. While this is valid in YAML 1.2 (there is no ambiguity with YAML directives in this context), it was not valid in YAML 1.1, and the Pygment syntax highlighter for YAML was based on the 1.1 spec, and so is not able to highlight this code.
The fix done in other parts of the doc is to switch to quoted values for these cases

@iamdto
Copy link
Contributor Author

iamdto commented Jul 16, 2014

Thanks @stof, I've added some comments in #4030.

weaverryan added a commit that referenced this issue Jul 29, 2014
This PR was merged into the 2.3 branch.

Discussion
----------

enclose YAML strings containing % with quotes

| Q             | A
| ------------- | ---
| Doc fix?      | yes
| New docs?     | no
| Applies to    | all
| Fixed tickets | #1886, #4029

Thanks @iamdto, did you spot some other occurences in the docs?

Commits
-------

c1c4bc8 remove "..." from XML element tags
dbc02a2 quote YAML strings starting with % or @ characters
@xabbuh
Copy link
Member

xabbuh commented Jul 29, 2014

I guess with #4030 being merged now, this can be closed.

@wouterj
Copy link
Member

wouterj commented Jul 29, 2014

At least, the documentation issues in this issue are now fixed.

Thanks you, @iamdto for you help in catching and finding the problematic spots in the docs!

@javiereguiluz can you please fix the blog post?

@wouterj wouterj closed this as completed Jul 29, 2014
@javiereguiluz
Copy link
Member

@wouterj I don't know what we should fix in the blog post. The first YAML code block appears with the right colors (but unnumbered). Is that correct?

@wouterj
Copy link
Member

wouterj commented Jul 29, 2014

@javiereguiluz this is what I'm seeing:

schermafdruk van 2014-07-29 22 40 12

It doesn't have the right colors (only background color) and it is unnumbered because the highlighter isn't executed. That's because it contains an "error" (it was an error in Yaml 1.0). You should update it like this:

monolog:
    handlers:
        main:
            type:   stream
---            path:   %kernel.logs_dir%/%kernel.environment%.log
+++            path:   "%kernel.logs_dir%/%kernel.environment%.log"
            level:  debug
        console:
            type:   console

@javiereguiluz
Copy link
Member

@wouterj thanks for the explanation :)

@Tobion could you please edit this blog post that you published and enclose the value of the path parameter with quotes? Thank you! This is the post: http://symfony.com/blog/new-in-symfony-2-4-show-logs-in-console

@Tobion
Copy link
Contributor

Tobion commented Jul 30, 2014

Cool I can edit this. This is new. I've updated it.

@xabbuh
Copy link
Member

xabbuh commented Jul 30, 2014

👍

@wouterj
Copy link
Member

wouterj commented Jul 30, 2014

Thanks @Tobion !

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

6 participants