Skip to content

Commit

Permalink
Merge pull request #239 from zazuko/mc-default-prefix-update
Browse files Browse the repository at this point in the history
Change default prefix to `content-`
  • Loading branch information
ludovicm67 authored Dec 12, 2023
2 parents 368019a + 20681d2 commit e0b7e8b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/dry-seals-marry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@zazuko/trifid-markdown-content": patch
---

Change default value for `idPrefix` from `markdown-content-` to `content-`.
4 changes: 2 additions & 2 deletions packages/markdown-content/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ The following options are supported:
You can define them in the `defaults` section or in specific entries in the `entries` section.
Those options are all optional.

- `idPrefix`: The prefix to use for the generated IDs for headings (default: `markdown-content-`).
- `idPrefix`: The prefix to use for the generated IDs for headings (default: `content-`).
- `classes`: The classes to add to the generated HTML (default: `{}`). Keys should be the CSS selectors, and values should be the classes to add.
- `autoLink`: If `true`, will automatically add links to headings (default: `true`).
- `template`: Path to an alternative template (default: `views/content.hbs`).
Expand All @@ -78,7 +78,7 @@ middlewares:
order: 80
config:
defaults:
idPrefix: markdown-content-
idPrefix: content-
classes:
h1: custom-h1
h2: custom-h2
Expand Down
2 changes: 1 addition & 1 deletion packages/markdown-content/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ const factory = async (trifid) => {
const defaults = config?.defaults || {}

// Default configuration
const idPrefix = defaultValue('idPrefix', defaults, 'markdown-content-')
const idPrefix = defaultValue('idPrefix', defaults, 'content-')
const classes = defaultValue('classes', defaults, {})
const autoLink = defaultValue('autoLink', defaults, true)
const template = defaultValue('template', defaults, `${currentDir}/../views/content.hbs`)
Expand Down
8 changes: 4 additions & 4 deletions packages/markdown-content/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ describe('@zazuko/trifid-markdown-content', () => {

const res = await fetch(pluginUrl)
const body = await res.text()
const match = body.match(/ href="#markdown-content-title"/) || false
const match = body.match(/ href="#content-title"/) || false

strictEqual(res.status, 200)
strictEqual(match && match.length > 0, true)
Expand Down Expand Up @@ -472,7 +472,7 @@ describe('@zazuko/trifid-markdown-content', () => {

const res = await fetch(pluginUrl)
const body = await res.text()
const match = body.match(/ href="#markdown-content-title"/) || false
const match = body.match(/ href="#content-title"/) || false

strictEqual(res.status, 200)
strictEqual(match && match.length > 0, false)
Expand Down Expand Up @@ -604,7 +604,7 @@ describe('@zazuko/trifid-markdown-content', () => {

const res = await fetch(pluginUrl)
const body = await res.text()
const match = body.match(/ href="#markdown-content-title"/) || false
const match = body.match(/ href="#content-title"/) || false

strictEqual(res.status, 200)
strictEqual(match && match.length > 0, true)
Expand Down Expand Up @@ -669,7 +669,7 @@ describe('@zazuko/trifid-markdown-content', () => {

const res = await fetch(pluginUrl)
const body = await res.text()
const match = body.match(/ href="#markdown-content-title"/) || false
const match = body.match(/ href="#content-title"/) || false

strictEqual(res.status, 200)
strictEqual(match && match.length > 0, false)
Expand Down

0 comments on commit e0b7e8b

Please sign in to comment.