Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
nvlang committed Jun 28, 2024
1 parent e101db6 commit 22caf23
Show file tree
Hide file tree
Showing 28 changed files with 629 additions and 5,521 deletions.
78 changes: 78 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@

# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to make participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies within all project spaces, and it also applies when
an individual is representing the project or its community in public spaces.
Examples of representing a project or community include using an official
project e-mail address, posting via an official social media account, or acting
as an appointed representative at an online or offline event. Representation of
a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at
[security@sveltex.dev](mailto:security@sveltex.dev). All complaints will be
reviewed and investigated and will result in a response that is deemed necessary
and appropriate to the circumstances. The project team is obligated to maintain
confidentiality with regard to the reporter of an incident. Further details of
specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ To contribute to SvelTeX, fork the repository, create a branch, commit your
changes, and submit a pull request. Furthermore:

- Please add meaningful tests for your changes that cover all new code paths
and edge cases. If applicable, also add E2E Playwright tests.
and edge cases (exception: VS Code SvelTeX extension). If applicable, also
add E2E Playwright tests.
- Please ensure that all tests pass before submitting your pull request.
- Please ensure that your code follows the existing code style and formatting.
- Please ensure that your code is well-documented, and possibly update
Expand Down
File renamed without changes.
5 changes: 5 additions & 0 deletions extras/vscode-extension/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
syntaxes/*.json
syntaxes/*.json_default
out
node_modules
external
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.vscode/**
.vscode-test/**
.gitignore
vsc-extension-quickstart.md

7 changes: 7 additions & 0 deletions extras/vscode-extension/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Change Log

## [1.0.0] - 2024-06-28

### Added

- Added basic support for SvelTeX syntax highlighting.
58 changes: 58 additions & 0 deletions extras/vscode-extension/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# SvelTeX language support

This extension adds syntax highlighting intended for [SvelTeX] files. SvelTeX is a
preprocessor for Svelte that aims to combine markdown, Svelte, and (some) LaTeX.

## Features

- Svelte + Markdown syntax highlighting (incl. fenced code blocks, though only with ~40 languages).
- Syntax highlighting for math expressions in `$...$`, `$$...$$`, `\(...\)`, and
`\[...\]` delimiters.
- LaTeX syntax highlighting in "LaTeX tags" (configurable).
- Turn off highlighting in "Escape tags" (configurable).
- `<script>` languages: JavaScript, TypeScript
- `<style>` languages: CSS, SCSS, SASS, PostCSS, Stylus

![screenshot](res/screenshot-ayu-dark-bordered.png)

## Requirements

This extension requires the `svelte.svelte-vscode` VS Code extension to be installed.
This is because the TextMate grammar for SvelTeX depends on Svelte's TextMate
grammar.

## Extension Settings

This extension contributes the following settings:

- `sveltex.latexTags`: Tags to use for LaTeX components. In effect, this will
just modify this extension's TextMate grammar so that the contents of these
tags are highlighted as LaTeX.
- `sveltex.escapeTags`: Tags to use for non-TeX verbatim components. In
effect, this will just modify this extension's TextMate grammar so that the
contents of these tags are highlighted the same way as a plaintext fenced
code block would in markdown.

> [!NOTE]
> You might need to reload the window for the changes to take effect.
## Limitations

- In LaTeX / math expressions, you may sometimes wish to have unbalanced
brackets (e.g., `[0, 1)` for intervals). Because of this, bracket matching
inside math scopes is turned off.

## Known Issues

- For `<style>` tags, LESS is not supported.
- For `<script>` tags, CoffeeScript is not supported. However, since SvelteKit
doesn't support CoffeeScript, this is not a priority.

## Release Notes

### 1.0.0

Initial release.


[SvelTeX]: https://sveltex.dev/
37 changes: 37 additions & 0 deletions extras/vscode-extension/language-configuration-markdown.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"comments": { "blockComment": ["<!--", "-->"] },
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
],
"colorizedBracketPairs": [],
"autoClosingPairs": [
{ "open": "{", "close": "}" },
{ "open": "[", "close": "]" },
{ "open": "(", "close": ")" },
{ "open": "<", "close": ">", "notIn": ["string"] }
],
"surroundingPairs": [
["(", ")"],
["[", "]"],
["`", "`"],
["_", "_"],
["*", "*"],
["{", "}"],
["'", "'"],
["\"", "\""],
["<", ">"]
],
"folding": {
"offSide": true,
"markers": {
"start": "^\\s*<!--\\s*#?region\\b.*-->",
"end": "^\\s*<!--\\s*#?endregion\\b.*-->"
}
},
"wordPattern": {
"pattern": "(\\p{Alphabetic}|\\p{Number}|\\p{Nonspacing_Mark})(((\\p{Alphabetic}|\\p{Number}|\\p{Nonspacing_Mark})|[_])?(\\p{Alphabetic}|\\p{Number}|\\p{Nonspacing_Mark}))*",
"flags": "ug"
}
}
175 changes: 175 additions & 0 deletions extras/vscode-extension/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
{
"name": "sveltex",
"displayName": "SvelTeX",
"description": "Svelte + Markdown + LaTeX",
"version": "1.0.0",
"homepage": "https://sveltex.dev/",
"keywords": [
"sveltex",
"svelte",
"latex",
"markdown",
"vscode"
],
"main": "./out/extension.js",
"publisher": "nvlang",
"icon": "res/icon@256.png",
"pricing": "Free",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/nvlang/sveltex.git"
},
"author": {
"name": "N. V. Lang",
"email": "hi@nvlang.dev",
"url": "https://nvlang.dev/"
},
"contributors": [
{
"name": "N. V. Lang",
"email": "hi@nvlang.dev",
"url": "https://nvlang.dev/"
}
],
"engines": {
"vscode": "^1.67.0"
},
"categories": [
"Programming Languages"
],
"scripts": {
"vscode:prepublish": "pnpm build",
"build": "node scripts/build.mjs && tsc -p tsconfig.json"
},
"extensionDependencies": [
"svelte.svelte-vscode"
],
"contributes": {
"configuration": {
"type": "object",
"properties": {
"sveltex.latexTags": {
"type": "array",
"default": [
"tex",
"latex",
"tikz"
],
"description": "Tags to use for TeX components. Case-insensitive. Note: tag names must match the regex `[a-zA-Z][-.:0-9_a-zA-Z]*`, otherwise they will be ignored."
},
"sveltex.escapeTags": {
"type": "array",
"default": [
"verb",
"verbatim"
],
"description": "Tags to use for non-TeX verbatim components. Case-insensitive. Note: tag names must match the regex `[a-zA-Z][-.:0-9_a-zA-Z]*`, otherwise they will be ignored."
}
}
},
"languages": [
{
"id": "sveltex",
"aliases": [
"SvelTeX",
"sveltex"
],
"extensions": [
".sveltex"
],
"configuration": "./language-configuration.json"
},
{
"id": "markdown-for-sveltex",
"configuration": "./language-configuration-markdown.json"
}
],
"grammars": [
{
"language": "sveltex",
"scopeName": "source.sveltex",
"path": "./syntaxes/sveltex.tmLanguage.json",
"balancedBracketScopes": [
"*",
"meta.embedded"
],
"unbalancedBracketScopes": [
"markup.fenced_code",
"meta.math.block.tex",
"support.class.math.block.tex",
"meta.function.environment.math.latex",
"support.class.math.block.environment.latex"
],
"embeddedLanguages": {
"source.svelte": "svelte",
"text.markdown": "markdown-for-sveltex",
"text.tex.latex": "latex",
"source.js": "javascript",
"source.css": "css",
"source.css.scss": "scss",
"source.sass": "sass",
"source.css.postcss": "postcss"
}
},
{
"language": "markdown-for-sveltex",
"scopeName": "text.markdown",
"path": "./syntaxes/markdown.tmLanguage.json",
"embeddedLanguages": {
"meta.embedded.block.html": "html",
"source.js": "javascript",
"source.css": "css",
"meta.embedded.block.css": "css",
"meta.embedded.block.ini": "ini",
"meta.embedded.block.java": "java",
"meta.embedded.block.lua": "lua",
"meta.embedded.block.makefile": "makefile",
"meta.embedded.block.perl": "perl",
"meta.embedded.block.r": "r",
"meta.embedded.block.ruby": "ruby",
"meta.embedded.block.php": "php",
"meta.embedded.block.sql": "sql",
"meta.embedded.block.vs_net": "vs_net",
"meta.embedded.block.xml": "xml",
"meta.embedded.block.xsl": "xsl",
"meta.embedded.block.yaml": "yaml",
"meta.embedded.block.dosbatch": "dosbatch",
"meta.embedded.block.clojure": "clojure",
"meta.embedded.block.coffee": "coffee",
"meta.embedded.block.c": "c",
"meta.embedded.block.cpp": "cpp",
"meta.embedded.block.diff": "diff",
"meta.embedded.block.dockerfile": "dockerfile",
"meta.embedded.block.go": "go",
"meta.embedded.block.groovy": "groovy",
"meta.embedded.block.pug": "jade",
"meta.embedded.block.javascript": "javascript",
"meta.embedded.block.json": "json",
"meta.embedded.block.jsonc": "jsonc",
"meta.embedded.block.latex": "latex",
"meta.embedded.block.less": "less",
"meta.embedded.block.objc": "objc",
"meta.embedded.block.scss": "scss",
"meta.embedded.block.perl6": "perl6",
"meta.embedded.block.powershell": "powershell",
"meta.embedded.block.python": "python",
"meta.embedded.block.rust": "rust",
"meta.embedded.block.scala": "scala",
"meta.embedded.block.shellscript": "shellscript",
"meta.embedded.block.typescript": "typescript",
"meta.embedded.block.typescriptreact": "typescriptreact",
"meta.embedded.block.csharp": "csharp",
"meta.embedded.block.fsharp": "fsharp"
},
"unbalancedBracketScopes": [
"markup.underline.link.markdown",
"punctuation.definition.list.begin.markdown"
]
}
]
},
"devDependencies": {
"@types/vscode": "^1.90.0"
}
}
Loading

0 comments on commit 22caf23

Please sign in to comment.