Skip to content

Instantly share code, notes, and snippets.

View chrisjsewell's full-sized avatar

Chris Sewell chrisjsewell

  • École Polytechnique Fédérale de Lausanne
  • Switzerland
  • 07:24 (UTC +02:00)
  • X @chrisj_sewell
View GitHub Profile
This file has been truncated, but you can view the full file.
{"created": "2024-05-11T19:39:25.902806", "current_version": "2.1.0", "project": "Sphinx-Needs", "versions": {"2.1.0": {"created": "2024-05-11T19:39:25.902790", "filters": {}, "filters_amount": 0, "needs": {"ACT_ANALYSIS": {"amount": "", "another_option": "", "arch": {}, "author": "", "avatar": "", "blocks": [], "checks": [], "closed_at": "", "comment": "", "completion": "", "config": "", "constraints": [], "constraints_passed": true, "constraints_results": {}, "content_id": "ACT_ANALYSIS", "created_at": "", "delete": null, "description": "", "docname": "directives/needsequence", "doctype": ".rst", "duration": "", "ends_with": [], "external_css": "external_link", "external_url": null, "full_title": "Analysis issue", "github": "", "has_dead_links": false, "has_forbidden_dead_links": false, "hours": "", "id": "ACT_ANALYSIS", "id_prefix": "", "image": "", "is_external": false, "is_modified": false, "is_need": true, "is_part": false, "jinja_content": null, "layout": "", "links": ["USER_B"], "max_amount": "", "max
This file has been truncated, but you can view the full file.
{"created": "2024-05-11T19:39:25.902806", "current_version": "2.1.0", "project": "Sphinx-Needs", "versions": {"2.1.0": {"created": "2024-05-11T19:39:25.902790", "filters": {}, "filters_amount": 0, "needs": {"ACT_ANALYSIS": {"amount": "", "another_option": "", "arch": {}, "author": "", "avatar": "", "blocks": [], "checks": [], "closed_at": "", "comment": "", "completion": "", "config": "", "constraints": [], "constraints_passed": true, "constraints_results": {}, "content_id": "ACT_ANALYSIS", "created_at": "", "delete": null, "description": "", "docname": "directives/needsequence", "doctype": ".rst", "duration": "", "ends_with": [], "external_css": "external_link", "external_url": null, "full_title": "Analysis issue", "github": "", "has_dead_links": false, "has_forbidden_dead_links": false, "hours": "", "id": "ACT_ANALYSIS", "id_prefix": "", "image": "", "is_external": false, "is_modified": false, "is_need": true, "is_part": false, "jinja_content": null, "layout": "", "links": ["USER_B"], "max_amount": "", "max
This file has been truncated, but you can view the full file.
{"created": "2024-05-11T19:39:25.902806", "current_version": "2.1.0", "project": "Sphinx-Needs", "versions": {"2.1.0": {"created": "2024-05-11T19:39:25.902790", "filters": {}, "filters_amount": 0, "needs": {"ACT_ANALYSIS": {"amount": "", "another_option": "", "arch": {}, "author": "", "avatar": "", "blocks": [], "checks": [], "closed_at": "", "comment": "", "completion": "", "config": "", "constraints": [], "constraints_passed": true, "constraints_results": {}, "content_id": "ACT_ANALYSIS", "created_at": "", "delete": null, "description": "", "docname": "directives/needsequence", "doctype": ".rst", "duration": "", "ends_with": [], "external_css": "external_link", "external_url": null, "full_title": "Analysis issue", "github": "", "has_dead_links": false, "has_forbidden_dead_links": false, "hours": "", "id": "ACT_ANALYSIS", "id_prefix": "", "image": "", "is_external": false, "is_modified": false, "is_need": true, "is_part": false, "jinja_content": null, "layout": "", "links": ["USER_B"], "max_amount": "", "max

Why you can't have nested titles (a.k.a. headings) in Sphinx

Over the course of my maintenance of sphinx and sphinx extensions (including myst-parser, myst-nb and sphinx-needs) the question of using headings within directives, or more generally nested inside other nodes of the docutils document tree has come up multiple times.

To not have to repeat myself anymore, I decided to write this short doc, to explain why this is not possible (or at least generally a bad idea).

How headings are processed

Lets take the following reStructuredText document as an example:

@chrisjsewell
chrisjsewell / .ansible-lint
Last active December 5, 2020 01:22
ansible to GH actions
# use `# noqa xxx` at the end of a line, to ignore a particular error
# or add to the warn_list, to ignore for the whole project
warn_list: []
@chrisjsewell
chrisjsewell / readthdocs.scss
Created August 24, 2020 21:29
SCSS Examples
/*!
* Font Awesome 4.7.0 by @davegandy - http://fontawesome.io - @fontawesome
* License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)
*/
@font-face {
font-family: 'FontAwesome';
src: url("../fonts/fontawesome-webfont.eot?v=4.7.0");
src: url("../fonts/fontawesome-webfont.eot?#iefix&v=4.7.0") format("embedded-opentype"), url("../fonts/fontawesome-webfont.woff2?v=4.7.0") format("woff2"), url("../fonts/fontawesome-webfont.woff?v=4.7.0") format("woff"), url("../fonts/fontawesome-webfont.ttf?v=4.7.0") format("truetype"), url("../fonts/fontawesome-webfont.svg?v=4.7.0#fontawesomeregular") format("svg");
font-weight: normal;
font-style: normal;
@chrisjsewell
chrisjsewell / parse_file.py
Last active November 13, 2019 03:40
A prototype implementation of an IMarkdown parser
from contextlib import contextmanager
from nbconvert.preprocessors.execute import (
ExecutePreprocessor,
CellExecutionComplete,
Empty,
)
from panflute import CodeBlock, convert_text, Div
from panflute.tools import meta2builtin
import yaml
from textwrap import dedent
import re
from nbconvert.filters import (
indent,
strip_ansi,
escape_latex,
ansi2latex,
citation2latex,
@chrisjsewell
chrisjsewell / aiida_env
Last active March 2, 2019 00:54
this script initialises an aiida environment (created with conda)
#!/usr/bin/env bash
# for help
# source script_name -h
# this script initialises an aiida environment (created with conda) by:
# 0. Reading the required variables from a yaml config file (by default .aiida_envs.yaml)
# 1a. `source activate env_name`
# 1b. (optionally) activate required branches of github repos (`git -C path checkout branch`)
# 2. `export PGDATA=/path/to/database`