GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — An example of running prism alongside code-prettify by JonathanUsername · Pull Request #127 · pebblecode/pebblecode.github.io

Conversation

@JonathanUsername

@JonathanUsername JonathanUsername commented Aug 4, 2016

Copy link
Copy Markdown
Contributor

Jonathan King [5:52 PM]
there it’s running alongside code-prettify

[5:53]
with a little bit more logic in the includer:

  <script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js" defer></script>
  <script src="{{ site.baseurl }}/js/vendor/prism.js" defer></script>
  <link rel="stylesheet" href="{{ site.baseurl }}/css/prism.css">
  <script>
  [].forEach.call(document.getElementsByTagName("pre"), function(el) {
    var prism = false;
    el.classList.forEach(function(i) {
      prism = /language-/.test(i) ? true : false;
    })
    if (!prism) el.classList.add("prettyprint");
  });
  </script>
{% endif %}

[5:53]
I’ll put it in a new branch though, and do a pull request

[5:53]
might be some other considerations, like size etc.

[5:54]
but you also need to specify the language for the given snippet. Here’s the markdown for that image:

      routeNum: ownProps.routes.filter(r => r.path).length
    })

So we can include two types of `name` prop in our Route components in `routes.js`:

1. Functions, that pull it out of state.
2. Strings, that are directly formatted.

<pre class="language-jsx">
  <code class="language-jsx">
    <Route name={state => state.locations.name} path={'locations/:id'} component={Locations}/>
    <Route name={'locations'} path={'locations/:id'} component={Locations}/>
  </code>
</pre>

Then, finally, we can do a bit of further mapping and reducing in the Breadcrumb container component to concatenate the paths correctly and evaluate the params.

    // Evaluate and replace multiple params in path
    // eg. door/:id/foo/:doorId -> door/2/foo/5
    const replaceParams = params => route => {
      const matches = route.path.match(/:([^\/]+)/g) || [];

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@JonathanUsername
An example of running prism alongside code-prettify
3d2af71
@JonathanUsername

JonathanUsername commented Aug 4, 2016

Copy link
Copy Markdown
Contributor Author

I tried to make the code colours the same, but didn't put much effort into it. could be done better using the existing code.scss

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This branch has not been deployed

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

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@JonathanUsername
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.