Releases: ipikuka/remark-flexible-containers
v1.2.1
The changes made by @talatkuyuk
- added a test util, and updated all the tests
- fixed: specific identifiers for the
title
should break the optiontitle: () => null
, and the title should take place
v1.2.0
Release notes and changes made by @talatkuyuk
- updated the dependencies
- added
package-lock.json
on behalf of npm clean install in the github actions - the options
titleProperties
andcontainerProperties
are not allowed to haveclassName
in the returned object - made refinements in the code
- improved the typing system,
@types/mdast
is extended with newContainer
type - added test coverage 100% and codecov connection
- added type coverage 100%
- added a github action for commits and pull requests
- added npm provenance
- added a test file for creating details-summary HTML elements via plugin
- updated README.md including badges, plugin list, options and support for specific identifiers sections
Added Support for Specific Identifiers
::: [type] [{tagname#id.classname}] [title] [{tagname#id.classname}]
Now, the remark-flexible-containers
supports syntax for specific identifiers (tagname
, id
, classnames
) for individual container
and title
node. For example:
::: info {section#foo.myclass} Title Of Information {span#baz.someclass}
<!-- content -->
:::
<section class="remark-container info myclass" id="foo">
<span class="remark-container-title info someclass" id="baz">
Title Of Information
</span>
<!-- content -->
</section>
The identifiers (tagname
, id
, classnames
) must be inside curly braces.
Syntax is very simple.
tagname
is to be compatible HTML tag name, and may present only once,id
is to start with hash#
, and may present only once,classnames
are to start with dot.
, and may present many.
There are two groups of identifiers. Each group is optional, may present or not.
The first group of identifiers (just after the type
) is for container
node.
The second group of identifiers (just after the title
) is for title
node.
Here are some example usages. For simplicity, I omitted the container contents and ending syntax, just put the beginning syntax in the examples. All are valid usage for specific identifiers.
These identifiers can be placed as all three, any two, or just any of them in the desired order, with or without a space between them. This is why the "flexibility" term comes from.
::: info {section#foo.myclass.second-class} Title {span#baz.someclass.other-class}
::: info {section#foo.myclass} Title {span#baz.someclass}
::: info {section #foo .myclass .second-class} Title {span #baz .someclass .other-class}
::: info {section #foo .myclass} Title {span #baz .someclass}
::: info {section.myclass#foo} Title {span.someclass#baz}
::: info {.myclass#foo} Title {.someclass#baz}
::: info {.myclass #foo} Title {.someclass #baz}
::: info {.myclass #foo section} Title {.someclass #baz span}
::: info {#foo section} Title {#baz span}
::: info {.myclass} Title {#baz}
::: info {#foo} Title {.someclass}
::: info {#foo} Title
::: info {#foo}
::: info {section#foo.myclass}
::: info Title {.someclass}
::: info Title {span#baz.someclass}
v1.1.0
Release notes and the changes made by @talatkuyuk
removed inconsistencies in the outputs whether there is an empty line or not
::: info
:::
and
::: info
:::
Now, both produces the output without <p>
inside the container,
<div class="remark-container info"></div>
Fixed a bug
if a break
node is the first child of a paragraph within the container, the break
node is removed.
Fixed a bug for the block-level html elements in markdown files (not related with mdx files)
Block-level html elements was causing a bug if the :::
closing container sign is just after the that element closing tag.
::: info Title
<p>Hi</p>
:::
For the fix, I added another visit
function for the html
nodes in the AST that if a html node.value ends with "\n:::", remove and carry it into a new paragraph.
Now, we don't need to put an empty line after the block-level html elements like <p>
tag in the container, before it was needed an empty line to work with "markdown" documents.
v1.0.7
Release notes and the changes made by @talatkuyuk
- updated the dependencies and fixed the type issues
- refactored the
.npmrc
file - refactored the
package.json
and thetsconfig.json
- updated the
README.md
having at least node version 16+ - fixed "Cannot find module" error in
ts-jest
test environment by addingmoduleResolution
- added a
callback function
for thetitle
option (breaking change !!!)
Before, thetitle
option wasnull | undefined
. If you wanted not to add atitle
node, the option wastitle: null
.
Now, thetitle
option is a callback function(type?: string, title?: string) => string | null | undefined
. If you want not to add atitle
node, the option istitle: () => null
. With that callback function, you are able to change the titles according to your logic. - added
callback function
option for the TagName and ClassName options in addition tostring
option
It will also provides you to define dynamic tag names and class names. - added the test files covering the new options
v1.0.6
Relesae Notes:
- removed the "unist-util-find-all-between" package (it causes "Error [ERR_REQUIRE_ESM]: require() of ES Module not supported" )
- added the "unist-util-find-between-all" package instead
- added
src
directory into files in package.json for source map support - added the list of the remark packages I have published into README.md
v1.0.5
- dummy commit for the fix that the README.md does not show in npm site
v1.0.4
Changes made by @talatkuyuk
- updated README.md
- fixed an import issue in a test file
- updated some dependencies
v1.0.3
Thanks to @remcohaszing for the advices; changes made by @talatkuyuk
- updated
eslint
config file - made minor refinement for constructing title and container
- corrected the config settings ensuring the package is for ESM only
v1.0.2
- adopted the
tsconfig
for ESM only as well.
v1.0.1
- removed the
unist-util-find
dependency which is not used in the project
Implemented the useful hints/tips given in the process of the package be included the remark-plugins list here (thanks to @remcohaszing)
- use the
prepack
script over theprepare
in package.json because theprepare
runs every installation in local butprepack
not - set the extension of the file
.eslintrc.json
because of without an extension is deprecated - change the script
prettier
for all files and add.prettierignore
in order to provide a way the CLI and your editor use the same settings - change the script
lint
for all files like prettier; and addoverrides
into the eslint config to make ESLint understand extensions - make the package is for ESM only since the package has ESM-only dependencies which means it doesn’t work with CJS