|
6 | 6 |
|
7 | 7 | from mkdocs_table_reader_plugin.safe_eval import parse_argkwarg |
8 | 8 | from mkdocs_table_reader_plugin.readers import READERS |
9 | | -from mkdocs_table_reader_plugin.markdown import fix_indentation |
| 9 | +from mkdocs_table_reader_plugin.markdown import fix_indentation, add_indentation |
10 | 10 |
|
11 | 11 | logger = get_plugin_logger("table-reader") |
12 | 12 |
|
@@ -73,6 +73,11 @@ def on_config(self, config, **kwargs): |
73 | 73 | config.plugins["macros"].macros.update(self.readers) |
74 | 74 | config.plugins["macros"].variables["macros"].update(self.readers) |
75 | 75 | config.plugins["macros"].env.globals.update(self.readers) |
| 76 | + |
| 77 | + config.plugins["macros"].filters.update({"add_indentation": add_indentation}) |
| 78 | + config.plugins["macros"].variables["filters"].update({"add_indentation": add_indentation}) |
| 79 | + config.plugins["macros"].env.filters.update({"add_indentation": add_indentation}) |
| 80 | + |
76 | 81 | self.external_jinja_engine = True |
77 | 82 | else: |
78 | 83 | self.external_jinja_engine = False |
@@ -144,7 +149,7 @@ def on_page_markdown(self, markdown, page, config, files, **kwargs): |
144 | 149 | # You might insert multiple CSVs with a single reader like read_csv |
145 | 150 | # Because of the replacement, the next occurrence will be the first match for .sub() again. |
146 | 151 | # This is always why when allow_missing_files=True we replaced the input tag. |
147 | | - markdown_table = fix_indentation(leading_spaces, markdown_table) |
| 152 | + markdown_table = fix_indentation(leading_spaces=leading_spaces, text=markdown_table) |
148 | 153 | markdown = tag_pattern.sub(markdown_table, markdown, count=1) |
149 | 154 |
|
150 | 155 | return markdown |
0 commit comments