docsifyjs/docsify

English quotes become Chinese quotes

kbmts opened this issue · 10 comments

There are two bugs

  1. English quotes become Chinese quotes. e.g. grep 'keyword' become grep ‘keyword’
  2. Two horizontal bars become one. e.g. --exclude become –exclude

Tried setting smartypants to false but it doesn't work.

How to fix it or how to change the default markdown parser?

Hi @kbmts , could you provide an reproduce?
It sounds weird and I can not reproduce it either.

Markdown does what it does, not sure how to avoid. Do you add plugins? Can't see your issue directly. Can you link to an example?

If you want to show pieces of code, use back ticks. For example,

Provide some `--option` to enable some feature. Internal code receives the string `'foo'`.

The output looks like this:

Provide some --option to enable some feature. Internal code receives the string 'foo'.

Hi, it seems the docsify-themeable plugin styling issue.

<script src="https://cdn.jsdelivr.net/npm/docsify-themeable@0/dist/js/docsify-themeable.min.js"></script>

@kbmts There's something in the code (not CSS style) that is generating the character.

Here is the source markdown file:

https://kbmts.github.io/docsify-test/README.md

# Docsify Test

## content1

ps -ef | grep 'web'

## content2

du -h --max-depth

A simple solution to this @kbmts is to wrap the code with backticks symbols (`). Change the markdown content to the following:

# Docsify Test

## content1

`ps -ef | grep 'web'`

## content2

`du -h --max-depth`

Here is a sample output:

Docsify Test

content1

ps -ef | grep 'web'

content2

du -h --max-depth

If you do this, then the normal text will have nicer looking quotes, but the inline code will not be transformed.

Also curious, if you remove docsify-themeable.min.js, does it stop transforming the quotes?

@trusktr @Koooooo-7 Thank you very much. It's the docsify-themeable js issue!

@jhildenbiddle does docsify-themeable.js change the quotes? If so, does it have a config option?

re-opening to track the quote issue (but feel free to unsubscribeif needed @kbmts).

@trusktr --

I don't believe it does, but I will verify and report back.

@kbmts @trusktr --

Bug confirmed and fixed.

From this comment:

It turns out the docsify-themeable JS was setting the markdown processor's smartypants option to true. Enabling this option "turns plain ASCII punctuation characters into "smart" typographic punctuation HTML entities" according to the SmartyPants project description. Mystery solved.

I've made the necessary change on the dev branch. I will publish an updated version when the next version of Docsify is released. That will hopefully happen in the next few weeks. In the meantime, you have two options:

  1. Wrap affected text in backticks (e,.g. ps -ef | grep 'web') as @trusktr recommended here.
  2. Download and locally host the current preview build of docsify-themeable.min.js which contains the fix.

Thanks!

Nice!