Testing the use of a "diff" view for some code samples #7455

wants to merge 5 commits into


None yet

3 participants


@weaverryan pointed out that some docs use the diff view for code samples (e.g. https://webpack.js.org/guides/code-splitting-css/#using-extracttextwebpackplugin) This is a test to see if this could work for us too. If it works, it'd be used selectively and only when it really makes sense.

@javiereguiluz javiereguiluz changed the base branch to symfony:2.7 from symfony:master Feb 8, 2017
@javiereguiluz javiereguiluz Testing the use of a "diff" view for some code samples
->register('mailer', 'Mailer')
- ->addArgument('%mailer.transport%');
++ ->addArgument('%mailer.transport%');
lyrixx Feb 8, 2017 edited Member

the (php) diff mean in the previous version a semicolon was missing.
(same comment applies to other php diff)

javiereguiluz added some commits Feb 8, 2017
@javiereguiluz javiereguiluz Import the DiffLexer 2df634d
@javiereguiluz javiereguiluz Fixed the code syntax

This is how it looks by default (we could tweak the design a bit):


See the rest at http://pr-7455-6snzjvi-6qmocelev2lwe.eu.platform.sh/components/dependency_injection.html

Personally I like this idea a lot because in some specific cases, the diff view is the best one when following an article from the start to the end.

The only negative points may be that:

  • It's a bit more difficult to go to a sample code and copy paste it without having to read all the previous code samples.
  • We lose the underlying language highlight (PHP in this example).
javiereguiluz added some commits Feb 8, 2017
@javiereguiluz javiereguiluz Testing the real diff format syntax
@javiereguiluz javiereguiluz Reverted the last change because it doesn't improve anything

Closing it because this was just an experiment to see if it was going to work.

wouterj commented Feb 10, 2017 edited

Ideally, we could support both in one syntax block (just like GitHub is doing recently in their diff views). I'm not 100% sure how to implement this as a Pygments lexer though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment