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

allow Markdown plugins loading fix #585 #589

Closed
wants to merge 2 commits into from
Closed

allow Markdown plugins loading fix #585 #589

wants to merge 2 commits into from

Conversation

neumayr
Copy link

@neumayr neumayr commented Jun 14, 2018

Summary

markdown.config currently requires a javascript function argument. This is only manageable with a config.js setup. I would like to allow markdown plugin loading also from a config.yml file.

I would propose a markdown.plugins endpoint that requires an Array. See implementation example.

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Docs
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix #xxx[,#xxx], where "xxx" is the issue number)

You have tested in the following browsers: (Providing a detailed version will be better.)

  • Chrome
  • Firefox
  • Safari
  • Edge
  • IE

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature
  • Related documents have been updated
  • Related tests have been updated

To avoid wasting your time, it's best to open a feature request issue first and wait for approval before working on it.

🔗💬 #585

Other information:

@neumayr
Copy link
Author

neumayr commented Sep 7, 2018

@ulivz Is there something missing from my side? I volunteer to make changes.

@neumayr
Copy link
Author

neumayr commented Sep 26, 2018

I've like to add a test to the code but I need some tips to pass the markdown.plugins configs.
@ulivz Do you think you could help me out here.

What I've done so far:

install development dependencies
  • yarn add --dev markdown-it-ins
  • yarn add --dev markdown-it-mark
test case inspired by slugify.spec.js
// test/markdown/plugin.spec.js
import { Md } from './util'
import ins from 'markdown-it-ins'
import mark from 'markdown-it-mark'

// const mdP = Md().use(ins).use(mark)
const mdP = Md().set({
  markdown: {
    plugins: ['ins', 'mark']
  }
})

const asserts = {
  'Demo ++inserted++ text.': '<p>Demo <ins>inserted</ins> text.</p>\n',
  'Demo ==marked== text.': '<p>Demo <mark>marked</mark> text.</p>\n'
}

describe('plugin', () => {
  test('should convert markdown w/ custom plugins', () => {
    for (const input in asserts) {
      const output = mdP.render(input)
      expect(output).toBe(asserts[input])
    }
  })
}) 

💥 This code is now working, especially the mdP const is not passing the markdown.plugins flags into the markdown parser. Who can help me here? 🙇‍♂️

@ulivz
Copy link
Member

ulivz commented Mar 12, 2019

Closing this in favor of #1422

@ulivz ulivz closed this Mar 12, 2019
@neumayr neumayr deleted the markdown-plugins branch March 13, 2019 11:50
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.

2 participants