Debian Codegraph @

tests/exporters/files/rst_output.ipynb

raw
1 {
2 "cells": [
3 {
4 "cell_type": "code",
5 "execution_count": 1,
6 "id": "d5202f0f-21b8-4509-a9e2-45caf1c7db7a",
7 "metadata": {},
8 "outputs": [],
9 "source": [
10 "from textwrap import indent\n",
11 "\n",
12 "\n",
13 "class Note:\n",
14 " def __init__(self, text):\n",
15 " self.text = text\n",
16 "\n",
17 " def _repr_html_(self):\n",
18 " return f'<div style=\"font-weight: bold; font-size: 16pt;\">{self.text}</div>'\n",
19 "\n",
20 " def _repr_mimebundle_(self, include=None, exclude=None):\n",
21 " return {\"text/x-rst\": \".. note::\\n\\n\" + indent(self.text, \" \")}"
22 ]
23 },
24 {
25 "cell_type": "code",
26 "execution_count": 2,
27 "id": "5145b05f-3a07-4cff-8738-516a9c27cb58",
28 "metadata": {},
29 "outputs": [
30 {
31 "data": {
32 "text/html": [
33 "<div style=\"font-weight: bold; font-size: 16pt;\">Testing testing</div>"
34 ],
35 "text/plain": [
36 "<__main__.Note at 0x7f457c0250d0>"
37 ],
38 "text/x-rst": [
39 ".. note::\n",
40 "\n",
41 " Testing testing"
42 ]
43 },
44 "execution_count": 2,
45 "metadata": {},
46 "output_type": "execute_result"
47 }
48 ],
49 "source": [
50 "Note(\"Testing testing\")"
51 ]
52 }
53 ],
54 "metadata": {
55 "kernelspec": {
56 "display_name": "Python 3 (ipykernel)",
57 "language": "python",
58 "name": "python3"
59 },
60 "language_info": {
61 "codemirror_mode": {
62 "name": "ipython",
63 "version": 3
64 },
65 "file_extension": ".py",
66 "mimetype": "text/x-python",
67 "name": "python",
68 "nbconvert_exporter": "python",
69 "pygments_lexer": "ipython3",
70 "version": "3.12.4"
71 }
72 },
73 "nbformat": 4,
74 "nbformat_minor": 5
75 }