Published by nvlang 3 months ago
6cc4dfb9c7e2b8177df6d790414e2d6658dc9231 Export metadata
from SvelTeX pages even if no frontmatter was found on the page in question. In those cases, we'll just have
<script context="module">
export const metadata = undefined;
</script>
which is better than the alternative
<script context="module">
</script>
because it won't cause import.meta.glob('...', { import: 'metadata', eager: true })
to throw an error if it reaches a SvelTeX page that doesn't have any frontmatter.
Full Changelog: https://github.com/nvlang/sveltex/compare/v0.4.0...v0.4.1
Published by nvlang 3 months ago
metadata
object and export that from within a <script context="module">
block. This enables us to now use tools like Vite's import.meta.glob('...', { import: 'metadata', eager: true })
to e.g. help render a list of available routes with whatever metadata was defined.script
preprocessor might run twice on the same file, given that Svelte files may include one <script>
tag and one <script context="module">
tag. Previously, doing this could lead to problematic behavior with SvelTeX, e.g., importing a component twice, causing an error.Full Changelog: https://github.com/nvlang/sveltex/compare/v0.3.2...v0.4.0
Published by nvlang 3 months ago
isImported
function, which is used to decide whether a "registered" component should be auto-imported.Full Changelog: https://github.com/nvlang/sveltex/compare/v0.3.1...v0.3.2
Published by nvlang 3 months ago
detectAndImportComponents
function. Also, don't try to import components that contain characters that wouldn't be allowed in a JS variable name.create-sveltex
package in README.Full Changelog: https://github.com/nvlang/sveltex/compare/v0.3.0...v0.3.1
Published by nvlang 3 months ago
Use sanitize-html
to ensure that HTML generated by Markdown processor is valid.
Remove <p>
tags within HTML elements or Svelte components that cannot contain paragraphs (e.g., <span><p>*text*</p></span>
becomes <span><em>text</em></span>
now, ignoring insignificant whitespace.
Add markdown.components
option to SvelTeX configuration to specify preferences in regards to how each Svelte component is treated by SvelTeX when it comes to whitespace adjustments.
Auto-import components "registered" in the markdown.components
array from the SvelTeX configuration if they are used in the markup and not already imported in the file's <script>
tag.
Note: a component is "registered" in the markdown.components
array iff there exists an object obj
in the markdown.components
array such that all of the following hold:
obj.name
equals the name of the component (case-sensitive).obj.importPath
is not undefined
.Add markdown.remarkRehypeOptions
and markdown.rehypeStringifyOptions
to SvelTeX configuration when the unified
Markdown backend is used.
markdown.directives.enabled
from true
to false
.markdown.components
to https://sveltex.dev/docs/markdown.Full Changelog: https://github.com/nvlang/sveltex/compare/v0.2.1...v0.3.0
deno.jsonc
.Published by nvlang 4 months ago
2585236cdd245fce5aef66fae84239539202c333 Pass original content to post-transformations.
The use-case that motivated this was wanting to add a post-transformer to the code handler that would add a "Copy Code" button to the resulting code block; for this purpose, it's useful to have the original code (i.e., before any syntax highlighting) available to the transformer, so that it can e.g. pass said content to a prop of a Svelte "Copy Code" button.
unified
markdown backend is being used with retext
plugins, messages emitted by said retext
plugins weren't being logged to the console. This commit fixes this issue.dependencies
property of the object returned by the SvelTeX preprocessor. With relative paths, changes in the corresponding files weren't triggering HMR updates.create-sveltex
in README.plop
to list of cool software that I didn't know before in README.XRegExp
from deps.ts
instead of xregexp
directly, in accordance with the centralized deps.ts
design principle.test
script from package.json
.vitest.config.ts
.knip.json
and tsconfig.check.json
).glob
and rimraf
(regular dependencies) and @vitest/coverage-v8
, @vitest/ui
, and vitest
(dev dependencies).target
in tsconfig.json
(ES2018
instead of ESNext
).package.json
and deno.jsonc
to 0.0.0
, and have the NPM resp. JSR publishing action bump the version within its local environment and publish a dirty branch, which is never actually committed. This simplifies the CI a bit, stops unsigned commits by GitHub Actions bot, and makes the existing discrepancy between tags and version strings in package.json
and deno.jsonc
less confusing (before, the version strings would always be just one release behind the tag; now, the version strings are always 0.0.0
, which is, by virtue of being clearly intentional, arguably less confusing).Published by nvlang 4 months ago
@types/mdast
from peer dependencies, since the unified
markdown backend doesn't need it.remark-retext
to (optional) peer dependencies, since the unified
markdown backend needs it.marked
) from package.json
.sveltex
keyword to package.json
.Published by nvlang 4 months ago
Published by nvlang 4 months ago
Published by nvlang 4 months ago
dist
directory structure (instead of having dist/src/mod.js
as the entry point, we now have dist/mod.js
) by setting rootDir
in tsconfig.release.json
to src
.Published by nvlang 4 months ago
process
from node:process
(instead of using it as a global variable), to increase compatibility with Deno.README.md
.Published by nvlang 4 months ago
Initial release.
Published by nvlang 4 months ago
Published by nvlang 4 months ago
Published by nvlang 4 months ago
Published by nvlang 4 months ago
Published by nvlang 4 months ago
Published by nvlang 4 months ago
Published by nvlang 4 months ago