Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ test-diff:
@$(SPHINX_BUILD) -M markdown "$(SOURCE_DIR)" "$(BUILD_DIR)/overrides" $(SPHINX_OPTS) $(O) -a \
-D markdown_http_base="https://localhost" -D markdown_uri_doc_suffix=".html" \
-D markdown_docinfo=1 -D markdown_anchor_sections=1 -D markdown_anchor_signatures=1 \
-D autodoc_typehints=signature -D markdown_bullet=-
-D autodoc_typehints=signature -D markdown_bullet=- -D markdown_flavor=github

@# Copy just the files for verification
@cp "$(BUILD_DIR)/overrides/markdown/auto-summery.md" "$(BUILD_DIR)/markdown/overrides-auto-summery.md"
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ You can add the following configurations to your `conf.py` file:
* `markdown_uri_doc_suffix`: If set, all references will link to documents with this suffix.
* `markdown_file_suffix`: Sets the file extension for generated markdown files (default: `.md`).
* `markdown_bullet`: Sets the bullet marker.
* `markdown_flavor`: If set to `github`, output will suit GitHub's flavor of Markdown.

For example, if your `conf.py` file have the following configuration:

Expand Down
1 change: 1 addition & 0 deletions sphinx_markdown_builder/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def setup(app) -> ExtensionMetadata:
app.add_config_value("markdown_anchor_signatures", False, "html", bool)
app.add_config_value("markdown_docinfo", False, "html", bool)
app.add_config_value("markdown_bullet", "*", "html", str)
app.add_config_value("markdown_flavor", "", "html", str)

return {
"version": __version__,
Expand Down
3 changes: 3 additions & 0 deletions sphinx_markdown_builder/translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,9 @@ def visit_image(self, node):
# noinspection PyPep8Naming
def visit_Text(self, node): # pylint: disable=invalid-name
text = node.astext().replace("\r", "")
# Replace line breaks with spaces to create single-line paragraphs
if self.config.markdown_flavor == "github":
text = text.replace("\n", " ")
if self.status.escape_text:
text = escape_markdown_chars(text)
self.add(text)
Expand Down
3 changes: 1 addition & 2 deletions tests/expected/overrides-auto-module.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ Deprecated since version 3.1: Use `other()` instead.

### func1(param1: [int](https://docs.python.org/3/library/functions.html#int)) → [int](https://docs.python.org/3/library/functions.html#int)

This is a function with a single parameter.
Thanks to github.com/remiconnesson.
This is a function with a single parameter. Thanks to github.com/remiconnesson.

* **Parameters:**
**param1** – This is a single parameter.
Expand Down
5 changes: 1 addition & 4 deletions tests/expected/overrides-auto-summery.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
<meta name="version" content="0.6.8"/>

<!-- Taken from https://github.com/FabianNiehaus/sphinx-markdown-builder-toctree-test -->
<!-- Sphinx-Markdown-Builder TocTree Test documentation master file, created by
sphinx-quickstart on Thu Sep 3 12:25:35 2020.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive. -->
<!-- Sphinx-Markdown-Builder TocTree Test documentation master file, created by sphinx-quickstart on Thu Sep 3 12:25:35 2020. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. -->

<a id="welcome-to-sphinx-markdown-builder-toctree-test-s-documentation"></a>

Expand Down
2 changes: 2 additions & 0 deletions tests/test_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
"markdown_bullet=-",
"-D",
"markdown_file_suffix=.html.md",
"-D",
"markdown_flavor=github",
"-j",
"8",
],
Expand Down