Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add indent option #13

Merged
merged 3 commits into from May 8, 2020
Merged

Add indent option #13

merged 3 commits into from May 8, 2020

Conversation

daguej
Copy link
Contributor

@daguej daguej commented Jan 3, 2020

This adds optional support for indentation of content rendered under headings.

With markdown.use(terminal, { indent: ' ' }) (two spaces):

Markdown Rendered
# Heading 1
## Heading 2
Some stuff indented twice
#
Only indented once
Heading 1
Heading 2
Some stuff indented twice

Only indented once

If the indent option is not specified, there should be no change to rendered content.


Bonus bugfix: While working on this feature, I discovered a bug in the way the library handles options. At instantiation, any options passed in overwrite the internal default options because _.merge(a, b) mutates a. This means that subsequent instantiations unexpectedly use options passed in previously.

a975738 adds a failing test that demonstrates the issue. fc7f464 fixes the bug, and also fixes a test that was mistakenly relying on this behavior.

@daguej
Copy link
Contributor Author

daguej commented Apr 28, 2020

@trabus thoughts?

@trabus
Copy link
Owner

trabus commented May 8, 2020

@daguej Sorry for the delay, this looks great! Thanks for the PR!

@trabus trabus merged commit 6b63cae into trabus:master May 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants