Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
c24cbd3
feat(cli): Add docname glob filter for list subcommand (#29)
SilverRainZ Aug 28, 2024
730e885
feat(ext): Add docname to keywords
SilverRainZ Aug 28, 2024
278f624
feat: Record document dependent files (#32)
SilverRainZ Oct 9, 2024
264be70
feat(integration): Use <C-k>d to input docname in vim (#33)
SilverRainZ Oct 13, 2024
8f80425
refactor: __init__.py -> snippets.py
SilverRainZ Oct 13, 2024
113979c
refactor: Move extension entrypoint from ext.py to __init__.py
SilverRainZ Oct 13, 2024
31a46cb
improve(cli): Optimize startup time
SilverRainZ Oct 13, 2024
4dc6f74
Merge pull request #34 from sphinx-notes/refactor/ext-entrypoint2
SilverRainZ Oct 14, 2024
a5e6fde
chore: Update project template to sphinx-notes/cookiecutter@c4f14dab
SilverRainZ Oct 17, 2024
b70dc37
fix: Handle broken pipe error (#36)
SilverRainZ Oct 19, 2024
021df50
chore: Type hinting fixes and update
SilverRainZ Oct 19, 2024
deef7e4
Impl code snippet (#37)
SilverRainZ Oct 21, 2024
d6db43f
feat(integration): General vim input helper (#38)
SilverRainZ Oct 27, 2024
633a342
fix(picker): Always pick document
SilverRainZ Feb 14, 2025
1ca3c9f
chore: Update project template to sphinx-notes/cookiecutter@7e07548a
SilverRainZ Feb 14, 2025
fe70d41
chore: Update project template to sphinx-notes/cookiecutter@0b096cd7
SilverRainZ Apr 26, 2025
6afcc0c
chore: Update project template to sphinx-notes/cookiecutter@800a79a0
SilverRainZ Oct 13, 2025
eb010e1
chore: Update project template to sphinx-notes/cookiecutter@4736b672
SilverRainZ Oct 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "https://github.com/sphinx-notes/template",
"commit": "80a61fa9abcd9474d8cfbc36d0bf5d41f99c916c",
"commit": "4736b672023e3bf4bc80d0d51850d7bc45ca1e12",
"checkout": null,
"context": {
"cookiecutter": {
Expand All @@ -14,7 +14,13 @@
"github_repo": "snippet",
"pypi_name": "sphinxnotes-snippet",
"pypi_owner": "SilverRainZ",
"_template": "https://github.com/sphinx-notes/template"
"is_python_project": true,
"python_version": "3.12",
"is_sphinx_extension": true,
"sphinx_version": "7.0",
"development_status": "3 - Alpha",
"_template": "https://github.com/sphinx-notes/template",
"_commit": "4736b672023e3bf4bc80d0d51850d7bc45ca1e12"
}
},
"directory": null
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ concurrency:

jobs:
pages:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
Expand Down
52 changes: 31 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,30 @@ RM = rm -rf
GIT = git
OPEN = xdg-open

# Build sphinx documentation.
.PHONY: docs
docs:
$(MAKE) -C docs/

# View sphinx HTML documentation in browser.
.PHONY: view
view:
$(OPEN) docs/_build/html/index.html

.PHONY: clean
clean:
$(MAKE) -C docs/ clean
$(RM) dist/
$(MAKE) -C docs/ clean; $(RM) dist/

.PHONY: clean
.PHONY: fmt
fmt:
ruff format src/
ruff format src/ && ruff check --fix src/

# Run unittest.
.PHONY: test
test:
$(PY) -m unittest discover -s tests -v

################################################################################
# Distribution Package
################################################################################

# Build distribution package, for "install" or "upload".
.PHONY: dist
dist: pyproject.toml clean
Expand All @@ -54,33 +54,43 @@ install: dist
upload: dist
$(PY) -m twine upload --repository pypi $</*

# Same to the aboved "upload" target, but this publishs to PyPI test server
# <https://test.pypi.org/>.
.PHONY: upload-test
upload-test: dist
$(PY) -m twine upload --repository testpypi $</*
################################################################################
# Cookiecutter Incremental Updates
################################################################################

# Keep up to date with the latest template.
# See also https://github.com/sphinx-notes/cookiecutter.
.PHONY: update-template
update-template:
# See https://github.com/sphinx-notes/cookiecutter.
.PHONY: tmpl-update tmpl-update-done tmpl-apply-rej

tmpl-update:
$(PY) -m cruft update

.PHONY: update-template-done
update-template-done:
tmpl-update-done:
$(GIT) commit -m "chore: Update project template to sphinx-notes/cookiecutter@$(shell jq -r '.commit' .cruft.json | head -c8)"

tmpl-apply-rej:
@for rej in $$(find . -name '*.rej'); do \
echo "applying $$rej..."; \
wiggle --replace $${rej%.rej} $$rej; \
done

# Update project version.
.PHONY: bump-version
.PHONY: bump-version bump-version-done

bump-version:
@echo -n "Please enter the version to bump: "
@read version && $(PY) -m cruft update --variables-to-update "{ \"version\" : \"$$version\" }"

# EXTRA TARGETS START
bump-version-done:
VERSION=$(shell jq -r '.context.cookiecutter.version' .cruft.json); \
$(GIT) commit -m "chore: Bump version to $$VERSION"; \
$(GIT) tag $$VERSION

################################################################################
# CUSTOM TARGETS
################################################################################

# Usage: make cli args=--help
.PHONY: cli
cli:
$(PY) ./utils/cli.py --config ./utils/conf.py $(args)

# EXTRA TARGETS END
5 changes: 1 addition & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,14 @@ sphinxnotes-snippet
.. |docs| image:: https://img.shields.io/github/deployments/sphinx-notes/snippet/github-pages
:target: https://sphinx.silverrainz.me/snippet
:alt: Documentation Status

.. |license| image:: https://img.shields.io/github/license/sphinx-notes/snippet
:target: https://github.com/sphinx-notes/snippet/blob/master/LICENSE
:alt: Open Source License

.. |pypi| image:: https://img.shields.io/pypi/v/sphinxnotes-snippet.svg
:target: https://pypi.python.org/pypi/sphinxnotes-snippet
:alt: PyPI Package

.. |download| image:: https://img.shields.io/pypi/dm/sphinxnotes-snippet
:target: https://pypi.python.org/pypi/sphinxnotes-snippet
:target: https://pypistats.org/packages/sphinxnotes-snippet
:alt: PyPI Package Downloads

|docs| |license| |pypi| |download|
Expand Down
11 changes: 0 additions & 11 deletions docs/_templates/confval.rst

This file was deleted.

31 changes: 0 additions & 31 deletions docs/_templates/example.rst

This file was deleted.

8 changes: 0 additions & 8 deletions docs/_templates/version.rst

This file was deleted.

71 changes: 17 additions & 54 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

import os
import sys

# -- Project information -----------------------------------------------------

project = 'sphinxnotes-snippet'
Expand All @@ -28,6 +25,7 @@
'sphinx.ext.githubpages',
'sphinx_design',
'sphinx_copybutton',
'sphinx_last_updated_by_git',
]

# Add any paths that contain templates here, relative to this directory.
Expand Down Expand Up @@ -74,49 +72,6 @@

# -- Extensions -------------------------------------------------------------

#
extensions.append('sphinxnotes.any')
from sphinxnotes.any import Schema, Field as F
#
version_schema = Schema('version',
name=F(unique=True, referenceable=True, required=True, form=F.Form.LINES),
attrs={'date': F(referenceable=True)},
content=F(form=F.Form.LINES),
description_template=open('_templates/version.rst', 'r').read(),
reference_template='🏷️{{ title }}',
missing_reference_template='🏷️{{ title }}',
ambiguous_reference_template='🏷️{{ title }}')
confval_schema = Schema('confval',
name=F(unique=True, referenceable=True, required=True, form=F.Form.LINES),
attrs={
'type': F(),
'default': F(),
'choice': F(form=F.Form.WORDS),
'versionadded': F(),
'versionchanged': F(form=F.Form.LINES),
},
content=F(),
description_template=open('_templates/confval.rst', 'r').read(),
reference_template='⚙️{{ title }}',
missing_reference_template='⚙️{{ title }}',
ambiguous_reference_template='⚙️{{ title }}')
example_schema = Schema('example',
name=F(referenceable=True),
attrs={'style': F()},
content=F(form=F.Form.LINES),
description_template=open('_templates/example.rst', 'r').read(),
reference_template='📝{{ title }}',
missing_reference_template='📝{{ title }}',
ambiguous_reference_template='📝{{ title }}')
#
any_schemas = [
version_schema,
confval_schema,
example_schema,
]
primary_domain = 'any'
#

extensions.append('sphinx.ext.extlinks')
extlinks = {
'issue': ('https://github.com/sphinx-notes/snippet/issues/%s', '💬%s'),
Expand All @@ -138,29 +93,37 @@
'jinja': ('https://jinja.palletsprojects.com/en/latest/', None),
}

#
extensions.append('sphinx_sitemap')
sitemap_filename = "sitemap.xml"
sitemap_url_scheme = "{link}"

extensions.append('sphinxext.opengraph')
ogp_site_url = html_baseurl
ogp_site_name = project
ogp_image = html_baseurl + '/' + html_logo

extensions.append('sphinxnotes.comboroles')
comboroles_roles = {
'parsed_literal': (['literal'], True),
}
#

#
extensions.append('sphinxnotes.project')
primary_domain = 'any'

# -- Eat your own dog food --------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
import os
import sys
sys.path.insert(0, os.path.abspath('../src/sphinxnotes'))
extensions.append('snippet.ext')
extensions.append('snippet')

# DOG FOOD CONFIGURATION START
# CUSTOM CONFIGURATION

snippet_config = {
'cache_dir': '/tmp/' + 'sphinxnotes-snippet'
}

extensions.append('sphinxcontrib.asciinema')

# DOG FOOD CONFIGURATION END
#
14 changes: 8 additions & 6 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@
sphinxnotes-snippet
===================

.. |docs| image:: https://img.shields.io/github/deployments/sphinx-notes/snippet/github-pages
.. |docs| image:: https://img.shields.io/github/deployments/sphinx-notes/snippet/github-pages?label=docs
:target: https://sphinx.silverrainz.me/snippet
:alt: Documentation Status

.. |license| image:: https://img.shields.io/github/license/sphinx-notes/snippet
:target: https://github.com/sphinx-notes/snippet/blob/master/LICENSE
:alt: Open Source License

.. |pypi| image:: https://img.shields.io/pypi/v/sphinxnotes-snippet.svg
:target: https://pypi.python.org/pypi/sphinxnotes-snippet
:target: https://pypistats.org/packages/sphinxnotes-snippet
:alt: PyPI Package

.. |download| image:: https://img.shields.io/pypi/dm/sphinxnotes-snippet
:target: https://pypi.python.org/pypi/sphinxnotes-snippet
:alt: PyPI Package Downloads
.. |github| image:: https://img.shields.io/badge/GitHub-181717?style=flat&logo=github&logoColor=white/
:target: https://github.com/sphinx-notes/snippet
:alt: GitHub Repository

|docs| |license| |pypi| |download|
|docs| |license| |pypi| |download| |github|

Introduction
============
Expand All @@ -44,12 +44,14 @@ Getting Started
We assume you already have a Sphinx documentation,
if not, see `Getting Started with Sphinx`_.


First, downloading extension from PyPI:

.. code-block:: console

$ pip install sphinxnotes-snippet


Then, add the extension name to ``extensions`` configuration item in your
:parsed_literal:`conf.py_`:

Expand Down
Loading