Fix css syntax highlighting conflict with bulma title

This commit is contained in:
Sebastian Sdorra
2020-10-26 15:24:54 +01:00
parent 19bd660ddb
commit 99dae1c1bc
6 changed files with 187 additions and 1 deletions

View File

@@ -30,6 +30,7 @@ import JavaHttpServer from "./__resources__/HttpServer.java";
import GoHttpServer from "./__resources__/HttpServer.go";
import JsHttpServer from "./__resources__/HttpServer.js";
import PyHttpServer from "./__resources__/HttpServer.py";
import Markdown from "./__resources__/test-page.md";
const Spacing = styled.div`
padding: 1em;
@@ -56,6 +57,11 @@ storiesOf("SyntaxHighlighter", module)
<SyntaxHighlighter language="python" value={PyHttpServer} />
</Spacing>
))
.add("Markdown", () => (
<Spacing>
<SyntaxHighlighter language="markdown" value={Markdown} />
</Spacing>
))
.add("Without line numbers", () => (
<Spacing>
<SyntaxHighlighter language="java" value={JavaHttpServer} showLineNumbers={false} />

View File

@@ -0,0 +1,118 @@
/*
* MIT License
*
* Copyright (c) 2020-present Cloudogu GmbH and Contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
export default {
files: [
{
oldPath: "CHANGELOG.md",
newPath: "CHANGELOG.md",
oldEndingNewLine: true,
newEndingNewLine: true,
oldRevision: "de732d6da1cc0be8454f004c14b7666c69c91fb4",
newRevision: "148eb799f3a56909fe65b966e093a482ba542c81",
type: "modify",
language: "markdown",
hunks: [
{
content: "@@ -5,7 +5,7 @@",
oldStart: 5,
newStart: 5,
oldLines: 7,
newLines: 7,
changes: [
{
content: "The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),",
type: "normal",
oldLineNumber: 5,
newLineNumber: 5,
isNormal: true
},
{
content: "and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).",
type: "normal",
oldLineNumber: 6,
newLineNumber: 6,
isNormal: true
},
{
content: "",
type: "normal",
oldLineNumber: 7,
newLineNumber: 7,
isNormal: true
},
{
content: "## Unreleased",
type: "delete",
lineNumber: 8,
isDelete: true
},
{
content: "## [2.7.1] - 2020-10-14",
type: "insert",
lineNumber: 8,
isInsert: true
},
{
content: "### Fixed",
type: "normal",
oldLineNumber: 9,
newLineNumber: 9,
isNormal: true
},
{
content:
"- Null Pointer Exception on anonymous migration with deleted repositories ([#1371](https://github.com/scm-manager/scm-manager/pull/1371))",
type: "normal",
oldLineNumber: 10,
newLineNumber: 10,
isNormal: true
},
{
content:
"- Null Pointer Exception on parsing SVN properties ([#1373](https://github.com/scm-manager/scm-manager/pull/1373))",
type: "normal",
oldLineNumber: 11,
newLineNumber: 11,
isNormal: true
}
]
}
],
_links: {
lines: {
href:
"http://localhost:8081/scm/api/v2/repositories/scmadmin/scm-manager/content/fbffdea2a566dc4ac54ea38d4aade5aaf541e7f2/CHANGELOG.md?start={start}&end={end}",
templated: true
}
}
}
],
_links: {
self: {
href:
"http://localhost:8081/scm/api/v2/repositories/scmadmin/scm-manager/diff/fbffdea2a566dc4ac54ea38d4aade5aaf541e7f2/parsed"
}
}
};

View File

@@ -29,6 +29,7 @@ import parser from "gitdiff-parser";
import simpleDiff from "../__resources__/Diff.simple";
import hunksDiff from "../__resources__/Diff.hunks";
import binaryDiff from "../__resources__/Diff.binary";
import markdownDiff from "../__resources__/Diff.markdown";
import { DiffEventContext, File, FileControlFactory } from "./DiffTypes";
import Toast from "../toast/Toast";
import { getPath } from "./diffs";
@@ -151,6 +152,10 @@ storiesOf("Diff", module)
});
return <Diff diff={filesWithLanguage} />;
})
.add("SyntaxHighlighting (Markdown)", () => {
// @ts-ignore
return <Diff diff={markdownDiff.files} />;
})
.add("CollapsingWithFunction", () => (
<Diff diff={diffFiles} defaultCollapse={(oldPath, newPath) => oldPath.endsWith(".java")} />
))

View File

@@ -112,6 +112,52 @@ const source: AnnotatedSource = {
]
};
const markdownSource: AnnotatedSource = {
language: "markdown",
lines: [
{
lineNumber: 1,
code: "# Title",
...commitCreateNewApp
},
{
lineNumber: 2,
code: "",
...commitCreateNewApp
},
{
lineNumber: 3,
code: "This is a short Markdown text.",
...commitFixedMissingImport
},
{
lineNumber: 4,
code: "",
...commitFixedMissingImport
},
{
lineNumber: 5,
code: "With **bold** and __italic__ words.",
...commitCreateNewApp
},
{
lineNumber: 6,
code: "",
...commitImplementMain
},
{
lineNumber: 7,
code: "> This should be a quote",
...commitCreateNewApp
},
{
lineNumber: 8,
code: "",
...commitCreateNewApp
}
]
};
const Robohash: FC = ({ children }) => {
const binder = new Binder("robohash");
binder.bind("avatar.factory", (person: Person) => `https://robohash.org/${person.mail}.png`);
@@ -124,6 +170,9 @@ storiesOf("Annotate", module)
.add("Default", () => (
<Annotate source={source} repository={repository} baseDate={new Date("2020-04-16T09:22:42Z")} />
))
.add("Markdown", () => (
<Annotate source={markdownSource} repository={repository} baseDate={new Date("2020-04-15T09:47:42Z")} />
))
.add("With Avatars", () => (
<Robohash>
<Annotate source={source} repository={repository} baseDate={new Date("2020-04-15T09:47:42Z")} />

View File

@@ -22,6 +22,10 @@
* SOFTWARE.
*/
/**
* IMPORTANT: If this file is changed, please run scritps/build-syntax-highlighting-javascript afterwards
*/
/* Generated with http://k88hudson.github.io/syntax-highlighting-theme-generator/www */
/* http://k88hudson.github.io/react-markdocs */
@@ -152,7 +156,8 @@ pre[class*="language-"] {
}
.token.important,
.token.bold {
.token.bold,
.token.title {
font-weight: bold;
}

View File

@@ -188,6 +188,9 @@ export default {
bold: {
fontWeight: "bold"
},
title: {
fontWeight: "bold"
},
italic: {
fontStyle: "italic"
},