Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/MarkBind/markbind into co…
Browse files Browse the repository at this point in the history
…nvert-to-code-block

* 'master' of https://github.com/MarkBind/markbind:
  Allow changing parameter properties (MarkBind#1075)
  Custom timezone for built-in timestamp (MarkBind#1073)
  Fix reload inconsistency when updating frontmatter (MarkBind#1068)
  Implement an api to ignore content in certain tags (MarkBind#1047)
  Enable AppVeyor CI (MarkBind#1040)
  Add heading and line highlighting to code blocks (MarkBind#1034)
  Add dividers and fix bug in siteNav (MarkBind#1063)
  Fixed navbar no longer covers modals (MarkBind#1070)
  Add copy code-block plugin (MarkBind#1043)
  Render plugins on dynamic resources (MarkBind#1051)
  Documentation for Implement no-* attributes for <box>  (MarkBind#1042)
  Migrate to bootstrap-vue popovers (MarkBind#1033)
  Refactor preprocess and url processing functions (MarkBind#1026)
  Add pageNav to Using Plugins Page (MarkBind#1062)

# Conflicts:
#	docs/userGuide/syntax/siteNavigationMenus.mbdf
  • Loading branch information
Tejas2805 committed Mar 7, 2020
2 parents 9720d63 + e521f97 commit a5c6f32
Show file tree
Hide file tree
Showing 120 changed files with 13,540 additions and 707 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ module.exports = {
"lodash/prefer-lodash-method": [0],
"lodash/prefer-noop": [0],
"max-len": ["error", { "code": 110 }],
"no-param-reassign": ["error", { "props": false }],
"operator-linebreak": ["error", "before"],
// override airbnb-base dev dependencies, latest version does not white list __mocks__
"import/no-extraneous-dependencies": [
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: node_js
node_js:
- '8'
- '10'
deploy:
# deploy on release, to markbind.org
- provider: script
Expand Down
17 changes: 17 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
environment:
nodejs_version: "10"

# Install scripts
install:
# Install nodejs version
- ps: Install-Product node $env:nodejs_version
# Install modules
- npm ci

# Post-install test scripts
test_script:
- node --version
- npm --version
- npm run testwin

build: off
103 changes: 102 additions & 1 deletion asset/css/markbind.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,36 @@ pre > code.hljs {
counter-reset: line;
}

pre > code.hljs[heading] {
border-top-right-radius: 0;
}

.code-block {
position: relative;
}

.code-block-heading {
background-color: #f2f2ff;
border-radius: 6px 6px 0 0;
color: #8787a5;
float: right;
font-size: 85%;
line-height: 1;
max-width: 85%;
overflow-wrap: break-word;
padding: 0.25em 0.4em;
text-align: right;
}

.code-block-content {
clear: both;
display: block;
}

code > span.highlighted {
background: lavender;
}

kbd {
background-color: #fafbfc;
border: 1px solid #c6cbd1;
Expand Down Expand Up @@ -94,7 +124,7 @@ code.hljs:hover {
header.header-fixed {
position: fixed;
width: 100%;
z-index: 9999;
z-index: 1000;
}

/* #app is treated as the main container */
Expand Down Expand Up @@ -340,3 +370,74 @@ li.footnote-item:target {
top: 0;
width: 3em;
}

/* hide popover, modal, tooltip content */
[data-mb-html-for] {
display: none;
}

/* styles for triggers */
.trigger {
text-decoration: underline dotted;
}

.modal.mb-zoom {
-webkit-transform: scale(0.1);
-moz-transform: scale(0.1);
-ms-transform: scale(0.1);
transform: scale(0.1);
opacity: 0;
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
transition: all 0.3s;
}

.modal.mb-zoom.show {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
opacity: 1;
}

/* "Copy" code block button */
pre {
position: relative;
}

.copy-btn {
background-color: #b4b4b9;
border-radius: 0.25rem;
color: #f8f8ff;
display: inline-block;
font-size: 75%;
line-height: 1;
padding: 0.25em 0.4em;
position: absolute;
right: 0.5em;
text-align: center;
top: 0.4em;
white-space: nowrap;
}

.copy-btn:hover {
color: #555;
}

.copy-btn-body {
align-items: center;
display: flex;
}

.copy-btn svg {
fill: currentColor;
margin-right: 0.4em;
}

.copy-btn-label {
font-size: 11px;
}

.copy-btn:focus {
outline: none;
}
33 changes: 33 additions & 0 deletions asset/js/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,39 @@ function setupWithSearch() {
setupSiteNav();
}

function makeInnerGetterFor(attribute) {
return (element) => {
const innerElement = element.querySelector(`[data-mb-html-for="${attribute}"]`);
return innerElement === null ? '' : innerElement.innerHTML;
};
}

function makeHtmlGetterFor(componentType, attribute) {
return (element) => {
const contentWrapper = document.getElementById(element.attributes.for.value);
return contentWrapper.dataset.mbComponentType === componentType
? makeInnerGetterFor(attribute)(contentWrapper) : '';
};
}

/* eslint-disable no-unused-vars */
/*
These getters are used by triggers to get their popover/tooltip content.
We need to create a completely new popover/tooltip for each trigger due to bootstrap-vue's implementation,
so this is how we retrieve our contents.
*/
const popoverContentGetter = makeHtmlGetterFor('popover', 'content');
const popoverHeaderGetter = makeHtmlGetterFor('popover', 'header');
const popoverInnerContentGetter = makeInnerGetterFor('content');
const popoverInnerHeaderGetter = makeInnerGetterFor('header');

const popoverGenerator = { title: popoverHeaderGetter, content: popoverContentGetter };
const popoverInnerGenerator = { title: popoverInnerHeaderGetter, content: popoverInnerContentGetter };

const tooltipContentGetter = makeHtmlGetterFor('tooltip', '_content');
const tooltipInnerContentGetter = makeInnerGetterFor('_content');
/* eslint-enable no-unused-vars */

if (enableSearch) {
setupWithSearch();
} else {
Expand Down
Binary file added docs/images/copyCode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/site.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"baseUrl": "",
"timeZone": "Asia/Singapore",
"titlePrefix": "MarkBind",
"pages": [
{
Expand Down
Loading

0 comments on commit a5c6f32

Please sign in to comment.