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

Code block render tab incorrectly #120

Open
albertyckwok opened this issue May 22, 2020 · 4 comments
Open

Code block render tab incorrectly #120

albertyckwok opened this issue May 22, 2020 · 4 comments
Labels

Comments

@albertyckwok
Copy link

albertyckwok commented May 22, 2020

The tab character is render as 4 spaces instead of 8.
Here is the test code block:

`123456789`
`<tab>9`

The following how it is rendered:

`123456789`
`    9`

The expect the result is:

`123456789`
`        9`

Thanks very much in advance
Albert

@albertyckwok albertyckwok changed the title Code block render tab as incorrectly Code block render tab incorrectly May 22, 2020
@simov simov added the prism label May 23, 2020
@simov
Copy link
Owner

simov commented May 23, 2020

That's controlled by the internal library used for syntax highlighting called Prism. Probably this plugin could help with configuring that aspect of it.

@albertyckwok
Copy link
Author

Thanks @simov, Do you know if it is possible to imbed JavaScript code in MK. According to the link, I need to put the following code in but it didn't seem to work.

<script type="text/javascript">
// Optional
Prism.plugins.NormalizeWhitespace.setDefaults({
        'tabs-to-spaces': 4,
});
</script>

@simov
Copy link
Owner

simov commented May 27, 2020

First you need to include the plugin with a <script> tag I think, because it's not part of what I have bundled with Prism.

For example see how I'm including MathJax in the content script. So in your case it have to be:

dom.push(m('script', {
  src: 'https://the-prism-plugin.js'
}))
dom.push(m('script', `
  Prism.plugins.NormalizeWhitespace.setDefaults({
          'tabs-to-spaces': 4,
  });
`))

And then you have to load the extension from your local fork instead.

Of course I can't tell with 100% certainty that it is going to work, but worth a try.

@albertyckwok
Copy link
Author

Thanks @simov, I will look into forking the code. I am setting vim with expandtab so that my team mates don't have to load my forked plugging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants