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

FR: Curly quotes from straight quotes #399

Closed
Calorion opened this issue Sep 5, 2022 · 12 comments · Fixed by #729
Closed

FR: Curly quotes from straight quotes #399

Calorion opened this issue Sep 5, 2022 · 12 comments · Fixed by #729
Assignees
Labels
markdown General Markdown or Markdown related issue or feature resolution/update-made A change has been made that should resolve this issue or request rule suggestion Suggestion to add or edit a rule

Comments

@Calorion
Copy link

Calorion commented Sep 5, 2022

Is Your Feature Request Related to a Problem? Please Describe.

I often run into straight quotes in my documents, either because my system put them in as I typed, or because I pasted some text in that contained them.

Describe the Solution You'd Like

I would like a Rule that changed straight single and double straight quotes to curly ones.

Describe Alternatives You've Considered

The Smart Typography plugin does this, but only as you type, not afterwards.

@Calorion Calorion added the rule suggestion Suggestion to add or edit a rule label Sep 5, 2022
@pjkaufman pjkaufman added the markdown General Markdown or Markdown related issue or feature label Sep 7, 2022
@Calorion Calorion changed the title FR: Smartenize quotes FR: Curly quotes from straight quotes Sep 22, 2022
@Calorion
Copy link
Author

Calorion commented Oct 8, 2022

This may help in implementing this feature: https://github.com/othree/smartypants.js

@pjkaufman
Copy link
Collaborator

As far as I am aware, this is not a hard feature to add, but this is not a high priority on my list of things to work on right now. I am open to PRs around this, but the most I can say about this right now is that it is in the project backlog and will be addressed as those tickets get worked through. Thanks for your patience!

@slappycat2
Copy link

Just looking at some issues with Smart Typography, there may be problems with converting to curly quotes with other parsing plugins, in particular Templator and the sidenotes CSS hack. This doesn't mean it can't be done, but I would see what @mgmeyers comes up with first. It might be nice to have, but at the risk of losing Templator-like plugins, I'll stick with straight quotes. ;-)

@pjkaufman
Copy link
Collaborator

As noted by @slappycat2, it will likely cause issues with YAML and plugins, so it is not recommended that the curly single or double quotes be used. Even so, I think that the custom regex feature that has been suggested (#455 ) would allow this change.

@Calorion
Copy link
Author

It should be possible to not convert within YAML or code blocks, right? Wouldn't that avoid the problem?

@pjkaufman
Copy link
Collaborator

That would potentially avoid the problem, but the custom regex would not know the difference. Thus you would have to use custom ignore (#334) to get finished in the next couple of releases to go ahead and do the change.

@pjkaufman
Copy link
Collaborator

So while it is possible, this would likely not be directly supported natively in the linter as a rule specifically for this. It would likely be made up of custom ignore and custom replace being used in conjunction with one another.

@pjkaufman
Copy link
Collaborator

Note that the issues with plugins like Templater would likely still exist as well as incompatibility with other plugins as well.

@Calorion
Copy link
Author

I mean—I'm not familiar with the Obsidian API, but does it report when something is supposed to be rendered in monospaced font?

@pjkaufman
Copy link
Collaborator

I don't think I understand the question. What do you mean report whether something is in monospaced font? It uses the same font for all present markdown unless css styling specifies otherwise.

@pjkaufman
Copy link
Collaborator

Just looking at some issues with Smart Typography, there may be problems with converting to curly quotes with other parsing plugins, in particular Templator and the sidenotes CSS hack. This doesn't mean it can't be done, but I would see what @mgmeyers comes up with first. It might be nice to have, but at the risk of losing Templator-like plugins, I'll stick with straight quotes. ;-)

When I am making this change, I am not adding any special concern for Templator. I may need to consider doing so to prevent issues with that plugin. I will reevaluate once I get the core of the logic in place. I am planning on ignoring code blocks, math block, inline code, inline math, YAML, and html. I may need to add a regex match for templater blocks as well to make sure I do not update them either as that is code. But the recent feature to turn off the Linter for specific portions of code (#725 ) should allow for ignoring Templater blocks manually.

@pjkaufman pjkaufman self-assigned this May 24, 2023
@pjkaufman pjkaufman added the resolution/update-made A change has been made that should resolve this issue or request label May 24, 2023
@pjkaufman
Copy link
Collaborator

This rule should be added in the next release. If it has any issues please let us know.

Note that this rule should ignore Templater blocks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
markdown General Markdown or Markdown related issue or feature resolution/update-made A change has been made that should resolve this issue or request rule suggestion Suggestion to add or edit a rule
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants