Skip to content

Commit

Permalink
Docs: Removed the Jinja2 sec. from the README
Browse files Browse the repository at this point in the history
- Docs: Remove extra newlines from the README.
  • Loading branch information
lucaslrodri committed Aug 11, 2024
1 parent 4acff96 commit 8b1e8eb
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 19 deletions.
23 changes: 8 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ You can test if a LaTeX distribution is installed by using the following command
pdflatex --version
```


### Poppler

This application requires Poppler's `pdftocairo`. You must install it beforehand.
Expand Down Expand Up @@ -99,13 +98,10 @@ Finally, you can check if the `pdftocairo` utility is installed by using the fol
pdftocairo -v
```



#### Using custom pdftocairo path

Alternatively, if you are facing issues, you can configure the `pdftocairo` location (exclusive for use in `jupyter_tikz`) by setting the environment variable `JUPYTER_TIKZ_PDFTOCAIROPATH`:


```python
import os
custom_pdftocairo_path = os.path.join(
Expand All @@ -114,12 +110,6 @@ custom_pdftocairo_path = os.path.join(
os.environ["JUPYTER_TIKZ_PDFTOCAIROPATH"] = custom_pdftocairo_path
```


### Jinja2

!!! note
Since [version 0.5](https://jupyter-tikz.readthedocs.io/stable/about/changelog), [Jinja2](https://jinja.palletsprojects.com/en/latest) is installed automatically, so it is no longer necessary to install this dependency manually.

## Install Jupyter TikZ

You can install `jupyter-tikz` by using the following command in your terminal:
Expand All @@ -128,7 +118,6 @@ You can install `jupyter-tikz` by using the following command in your terminal:
pip install jupyter-tikz
```


## Adding TikZ Syntax highlight

If you are using Jupyter Lab 4. You can add LaTeX highlight to `%%tikz` magic cells by using [JupyterLab-lsp](https://jupyterlab-lsp.readthedocs.io/en/latest/Installation.html) and editing [this part of the code in JupyterLab-lsp](https://github.com/jupyter-lsp/jupyterlab-lsp/blob/b159ae2736b26463d8cc8f0ef78f4b2ce9913370/packages/jupyterlab-lsp/src/transclusions/ipython/extractors.ts#L68-L74) in the file `extractor.ts`:
Expand Down Expand Up @@ -211,7 +200,6 @@ tikz.run_latex() # Run LaTeX and shows the output

All additional options are listed below:


| Argument | Description |
| -------- | ----------- |
| `-as=<str>`<br>`--input-type=<str>` | Type of the input. Possible values are: `full-document`, `standalone-document` and `tikzpicture`.<br>&nbsp;&nbsp;&nbsp;&nbsp;*Example:* `-as=full-document`.<br>&nbsp;&nbsp;&nbsp;&nbsp;*Defaults* to `-as=standalone-document`. |
Expand Down Expand Up @@ -240,7 +228,6 @@ All additional options are listed below:
| `-S=<str>`<br>`--save-image=<str>` | Save the output image to file.<br>&nbsp;&nbsp;&nbsp;&nbsp;*Example:* `-S filename.png`.<br>&nbsp;&nbsp;&nbsp;&nbsp;*Defaults* to None. |
| `-sv=<str>`<br>`--save-var=<str>` | Save the TikZ or LaTeX code to an IPython variable.<br>&nbsp;&nbsp;&nbsp;&nbsp;*Example:* `-sv my_var`.<br>&nbsp;&nbsp;&nbsp;&nbsp;*Defaults* to None. |


# Contribute

Contributions are welcome from everyone! Whether you're reporting bugs, submitting feedback, or actively improving the codebase, your involvement is valuable. Here's how you can contribute:
Expand All @@ -254,17 +241,23 @@ Contributions are welcome from everyone! Whether you're reporting bugs, submitti

All notable changes to this project are presented below.

## v0.5.4

**🐞 Bug Fixes**

- Docs: Removed the Jinja2 subsection from the README.

## v0.5.3

**🐞 Bug Fixes**

- Docs: Fixed Jinja section in installation.
- Docs: Fixed Jinja section in `installation`.

## v0.5.2

**🐞 Bug Fixes**

- Docs: Fixed internal links in index.
- Docs: Fixed internal links in `index`.

## v0.5.1

Expand Down
10 changes: 8 additions & 2 deletions docs/about/changelog.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
All notable changes to this project are presented below.

## v0.5.4

**🐞 Bug Fixes**

- Docs: Removed the Jinja2 subsection from the README.

## v0.5.3

**🐞 Bug Fixes**

- Docs: Fixed Jinja section in installation.md.
- Docs: Fixed Jinja section in `installation.md`.

## v0.5.2

**🐞 Bug Fixes**

- Docs: Fixed internal links in index.md.
- Docs: Fixed internal links in `index.md`.

## v0.5.1

Expand Down
28 changes: 27 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,22 @@ def args_table():

rendered_readme = tmpl.render(locals())

# Remove mkdocs admonitions
# 1. Define the regex pattern to match MkDocs admonitions
admonition_pattern = re.compile(
r'!!!\s+(note|abstract|info|tip|success|question|warning|failure|danger|bug|example|quote)\s*(?: ".*?")?\n (.+)(?:\s*)(?=.+)',
)

# 2. Replace MkDocs admonitions with GitHub alerts
print(re.findall(admonition_pattern, rendered_readme))
rendered_readme = admonition_pattern.sub("", rendered_readme)

# Remove code annotations
rendered_readme = re.sub(
r"\s\{\s\.(shell|python|latex)\s\.annotate\s\}", r"\1", rendered_readme
r"\s\{\s\.(shell|python|latex)\s\.annotate\s\}",
r"\1",
rendered_readme,
flags=re.DOTALL,
)

logterminal_div_pattern = '<div class="result log-terminal".*?>.*?</div>'
Expand Down Expand Up @@ -172,6 +186,18 @@ def args_table():
rendered_readme = re.sub(r"^1\.\s+.*$\n", "", rendered_readme, flags=re.MULTILINE)
rendered_readme = re.sub(r" #\s*\(\d+\)!", "", rendered_readme, flags=re.DOTALL)

# # Remove empty subsections

# # 1. Define the regex pattern to match empty subsections
empty_subsection_pattern = re.compile(r"###\s+.*\s*(?=\n##.*)")

# # 2. Remove empty subsections
rendered_readme = empty_subsection_pattern.sub("", rendered_readme)

# Remove more than two consecutive new lines
consecutive_newlines_pattern = re.compile(r"\n{3,}")
rendered_readme = consecutive_newlines_pattern.sub("\n\n", rendered_readme)

print(rendered_readme)

with open("README.md", "w", encoding="utf-8") as f:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "jupyter-tikz"
version = "0.5.3"
version = "0.5.4"
description = "IPython Magics for rendering TeX/TikZ in Jupyter Notebooks"
license = "MIT"
authors = ["lucaslrodri"]
Expand Down

0 comments on commit 8b1e8eb

Please sign in to comment.