Metadata-Version: 2.4
Name: sphinx-hackerrank
Version: 2026.11.3
Summary: Build portable HackerRank Interviewer Guidelines from Sphinx documentation.
Author-email: Adam Dangoor <adamdangoor@gmail.com>
License: MIT License
        
        Copyright (c) 2026 Rippling
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Issues, https://github.com/adamtheturtle/sphinx-hackerrank/issues
Project-URL: Source, https://github.com/adamtheturtle/sphinx-hackerrank
Keywords: documentation,rst,sphinx
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Web Environment
Classifier: Framework :: Sphinx :: Extension
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Requires-Python: >=3.12
Description-Content-Type: text/x-rst
License-File: LICENSE
Requires-Dist: beautifulsoup4>=4.15.0
Requires-Dist: sphinx<10,>=9.1.1
Dynamic: license-file

|Build Status| |PyPI|

sphinx-hackerrank
=================

Export Sphinx documentation as self-contained HTML for HackerRank Interviewer Guidelines, with styles and images.
Build and preview locally without HackerRank credentials.

Quick start
-----------

In an existing Sphinx project:

.. code-block:: console

   pip install sphinx-hackerrank

Add this to ``docs/conf.py`` (replace ``docs`` with your Sphinx source directory):

.. code-block:: python

   """Sphinx configuration."""

   from sphinx_hackerrank import GuidelineExport

   extensions = ["sphinx_hackerrank"]
   hackerrank_exports = [
       GuidelineExport(
           docname="review",
           selector=".hr-interviewer-guideline",
           output_path="interviewer-guidelines/review.html",
           name="Widget review",
       ),
   ]

Create ``docs/review.rst`` and add ``review`` to your existing toctree:

.. code-block:: rst

   Widget review
   =============

   .. container:: hr-interviewer-guideline

      Interviewer instructions go here.

      .. code-block:: text

         example input

Build:

.. code-block:: console

   sphinx-build -W -b hackerrank docs build/hackerrank

Open ``build/hackerrank/interviewer-guidelines/index.html`` to preview the exports.
Upload ``build/hackerrank/interviewer-guidelines/review.html`` using your own publishing tool.

Choosing content
----------------

Each ``GuidelineExport`` specifies:

* ``docname``: the RST path relative to your source directory, without ``.rst``.
* ``selector``: a CSS selector matching exactly one container in that page.
* ``output_path``: a unique HTML path relative to the build directory.
* ``name``: the label shown in the preview index.

Use the ``hr-interviewer-guideline`` container class for bundled styles.
The builder also produces ordinary themed documentation pages.

For collapsible sections, enable `sphinx-toolbox.collapse <https://sphinx-toolbox.readthedocs.io/en/stable/extensions/collapse.html>`_.
To reuse guide sections, enable `sphinx-section-include <https://github.com/adamtheturtle/sphinx-section-include>`_.
See the `sample project <https://github.com/adamtheturtle/sphinx-hackerrank/tree/main/sample>`_ for both.

Source links
------------

Links to other pages point to the local build by default.
To link to hosted documentation, set ``hackerrank_source_url = "https://example.org/guides/"`` in ``conf.py``.
For source files, set ``hackerrank_source_suffix = ".rst"`` too.
Set ``hackerrank_source_anchors = False`` if the destination does not support anchors.

Contributing
------------

See `CONTRIBUTING.rst <https://github.com/adamtheturtle/sphinx-hackerrank/blob/main/CONTRIBUTING.rst>`_ for checks and releases.
MIT licensed.

.. |Build Status| image:: https://github.com/adamtheturtle/sphinx-hackerrank/actions/workflows/ci.yml/badge.svg?branch=main
   :target: https://github.com/adamtheturtle/sphinx-hackerrank/actions
.. |PyPI| image:: https://badge.fury.io/py/sphinx-hackerrank.svg
   :target: https://badge.fury.io/py/sphinx-hackerrank
