You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by mabdullah353 <gi...@git.apache.org> on 2016/11/02 04:58:49 UTC

[GitHub] incubator-beam-site pull request #59: [BEAM-501] Infrastructure for toggling...

GitHub user mabdullah353 opened a pull request:

    https://github.com/apache/incubator-beam-site/pull/59

    [BEAM-501] Infrastructure for toggling code snippets in documentation.

    ## Working
    
    This commit will enable mark down language to support two languages `java` and `python`, By adding a nav bar on top of code blocks.
    
    Add html class as `language-python` or `language-java` and the HTML elements visibility will be controlled based on user selected language preferences.
    
    Code blocks in markdown languages starting with *```java* or *```python* have by default `langauge-java` or `language-python` classes so no special attributes required to apply this effect.
    
    ## Example
    
    1) Toggles for code block.
    
    Add python code below the java code in markdown language, It will be converted into selectable code block div.
    
    > ```java "some-code-in-java"
    
    > ```python "sam-code-in-python"
    
    And user will see block like this.
    
    <img width="1186" alt="screen shot 2016-11-02 at 9 47 30 am" src="https://cloud.githubusercontent.com/assets/1429432/19917036/70f0fcc8-a0e1-11e6-9a10-270927936d7f.png">
    
    
    2) Section of text.
    
    Wrap a text with attributes having class `language-java` or `language-python` and it's visibility will be changed based on user preferences.
    
    > To use Beam, your driver program must first create an instance of the Beam SDK class `Pipeline` <span class="language-java">(typically in the `main()` function)</span><span class="language-python">(typically in `def`)</span>.
    
    When `java` is selected then this will render as:
    <img width="1176" alt="screen shot 2016-11-02 at 9 50 54 am" src="https://cloud.githubusercontent.com/assets/1429432/19917102/045e7242-a0e2-11e6-9b02-615421a5fec4.png">
    
    And for `python` it will render as:
    
    <img width="1150" alt="screen shot 2016-11-02 at 9 51 23 am" src="https://cloud.githubusercontent.com/assets/1429432/19917113/1d2dfee6-a0e2-11e6-80b2-ba55f07f544e.png">
    
    
    3) User preference persistence:
    
    The language preference will be stored on HTML5 local storage, keeping it persistence per user bases.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/mabdullah353/incubator-beam-site asf-site

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-beam-site/pull/59.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #59
    
----
commit 2d80cee3be9da2515e927afd67541899b2dde258
Author: Abdullah Bashir <ma...@gmail.com>
Date:   2016-11-02T04:04:41Z

    [BEAM-501] Infrastructure for toggling code snippets in documentation

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-beam-site pull request #59: [BEAM-752] Infrastructure for toggling...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-beam-site/pull/59


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---