Skip to content

Need a way to mark differences from CPython in docs #983

Description

@pfalcon

Subj. This would apply to discrepancies, extensions, etc. Need just some markup pattern, ideally simple, but which would render visibly to a user.

And this probably should go hand in hand to providing link to upstream CPython documentation for a function (which should save us a lot of typing - if we really want to have all functions documented).

Activity

  1. dpgeorge commented on Nov 26, 2014

    @dpgeorge
    Member

    You can most probably define custom markup patterns in Sphinx, I just don't know how...

  2. pfalcon commented on Dec 6, 2014

    @pfalcon
    ContributorAuthor

    Well, what I mean here is that we need some convention how to mark such information so it was clearly visible. Yes, ideally which would be short custom tag, which would expand to an icon with link, which when clicked, opened a page with description what it means.

    But any markup which can be copy-pasted around would be good start - to save effort later to re-parse docs to find such places.

  3. dpgeorge commented on Dec 19, 2014

    @dpgeorge
    Member

    In 6d3ae56 I added a note about CPython difference using a generic admonition. The pattern to use is:

       .. admonition:: Difference to CPython
    
          Text explaining difference.
    

    This is general and easy to grep for. At the moment it doesn't render as anything special, but does emit a CSS class tag for the div, so can be easily styled.

    Next is to provide an easy way to link to CPython docs.

  4. dpgeorge commented on Dec 19, 2014

    @dpgeorge
    Member
  5. pfalcon commented on Dec 19, 2014

    @pfalcon
    ContributorAuthor

    Looks about right. Ideally, "text explaining the difference" would have some kind of background, so entire construct looked like kind of box. So, probably worth playing a bit more, but title definitely looks like expected, thanks for exploring it.

  6. dpgeorge commented on Dec 19, 2014

    @dpgeorge
    Member

    There's room to play with CSS to get it to look right. I'm sure you can box the whole thing, and even make it smaller font, etc.

  7. dpgeorge commented on Dec 21, 2014

    @dpgeorge
    Member

    I tried to add custom CSS: it works on my local machine, but doesn't on RTD server. I followed the docs on RTD for doing custom CSS, but seems that it's tricky to get it working. If anyone can fix it that would be much appreciated, otherwise this issue will remain open for some time...

  8. pfalcon commented on Dec 21, 2014

    @pfalcon
    ContributorAuthor

    Thanks for looking into this. I guess it's ok if this issue remains open and resolved in background - while it's pretty important to be resolved eventually, it's not the highest priority, even on docs side. I hope to look into it on good occasion of course.

    I tried to add custom CSS: it works on my local machine, but doesn't on RTD server.

    Can you please clarify whether you use default sphinx theme locally, or that RTD theme emulation package?

  9. dpgeorge commented on Dec 21, 2014

    @dpgeorge
    Member

    Can you please clarify whether you use default sphinx theme locally, or that RTD theme emulation package?

    I tried both. In both cases I get (on my local machine) a black border around the CPy difference admonition (since that's in the CSS I added). But doesn't work on RTD server.

  10. dhylands commented on Dec 21, 2014

    @dhylands
    Contributor

    Do you have a particular URL and point out something particular to look for?

    Th Firefox browser has an inspect element and you can see the final CSS for an element, and IIRC figure out where it came from.

  11. dpgeorge commented on Dec 21, 2014

    @dpgeorge
    Member
  12. dhylands commented on Dec 21, 2014

    @dhylands
    Contributor

    This file:
    https://github.com/micropython/micropython/blob/master/docs/templates/layout.html#L2
    refers to _static, but the name of your directory is static (no leading underscore)

  13. dpgeorge commented on Dec 21, 2014

    @dpgeorge
    Member

    I made a test branch, docs-test, and tried all different combinations of underscores and not. Take a look at the source of this page http://docs.micropython.org/en/docs-test/library/sys.html and you'll see that there is no mention of custom stylesheets being included.

  14. pfalcon commented on Dec 21, 2014

    @pfalcon
    ContributorAuthor

    @dpgeorge, http://read-the-docs.readthedocs.org/en/latest/faq.html shows colored boxes, which use somewhat different syntax: https://raw.githubusercontent.com/rtfd/readthedocs.org/master/docs/faq.rst . I guess those are "predefined admonitions". Maybe we can use those for starters.

  15. dpgeorge commented on Dec 22, 2014

    @dpgeorge
    Member

    You can use note/tip admonition class and define your own title, but it's a bit of a hack and we'll have to change it later.

  16. dpgeorge commented on Dec 22, 2014

    @dpgeorge
    Member

    Ok, it can be done doing the following: a generic admonition, with a specific class that is predefined. Like this:

    .. admonition:: Difference to CPython
       :class: attention
    
       Here be dragons.
    

    The predefined classes are, with their rendering colour:

    1. danger, error: red
    2. attention, caution, warning: orange
    3. hint, important, tip: green
    4. note: blue

    I think yellow looks best for this case.

  17. dpgeorge commented on Dec 22, 2014

    @dpgeorge
    Member
  18. dpgeorge commented on Jun 26, 2017

    @dpgeorge
    Member

    As discussed above, differences use the "adminition" tag combined with a "class", and this is used in the docs.

  19. added a commit that references this issue on Jul 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions