wp-tegaki Plugin Error on WordPress

Disabled wp-tegaki still throws a PHP parse error

Does the wp-tegaki plugin error even when it is disabled?

On a WordPress blog, the following error appeared even though the wp-tegaki plugin I used to run was already disabled. (wp-tegaki is no longer maintained and does not support PHP 7.x)

PHP Parse error:  syntax error, unexpected 'new' (T_NEW) in /var/www/html//wp-content/plugins/wp-tegaki/wp-tegaki-img.php on line 24

I was not using it anyway and it was annoying, so I deleted it.

These days it is better to use web fonts anyway.

Categories: WordPress  Tags: Plugin error 

Preventing Copy and Paste of Posts in Beautifulhugo

Applying copy-and-paste protection

Preventing copy and paste of posts

Referring to “テキストのドラッグ、画像のコピーを禁止して、記事をコピーさせない方法 ” (in Japanese), I disable text selection (dragging)

Note that this is applied for the Beautifulhugo theme, so adapt it as appropriate for other themes.

Adding the script

Add this inside the body tag

  • beautifulhugo/layouts/_default/baseof.html
<body onMouseDown="return false;" onSelectStart="return false">

Fixing the CSS

Add this to the css for body

  • beautifulhugo/static/css/main.css
user-select:none;
-webkit-user-select:none;
-ms-user-select: none;
-moz-user-select:none;
-khtml-user-select:none;
-webkit-user-drag:none;
-khtml-user-drag:none;

The point

In short, all you need to do is write the Javascript inside the body tag and apply the CSS to body in the CSS

Categories: hugo  Tags: beautifulhugo 

Hackmd, an Online Editor for Writing Markdown with a Preview

Writing and previewing Markdown online

A handy service that lets you write Markdown online with a preview https://hackmd.io/

The good points

  • Real-time preview
  • You can use a Dropbox or Google account
  • It is linked with imgur. Images you upload are automatically stored on imgur
  • Can export to Dropbox, Google Drive and Gist
  • Can import from Dropbox, Google Drive, Gist and the clipboard
  • Can be downloaded locally in markdown or HTML format
  • Content from YouTube, Vimeo, Gist, SlideShare and Speakerdeck can be embedded with simple notation
  • Sequence diagrams and flowcharts can be drawn as well

Writing MarkDown in this online service and pasting it into a Hugo article is nice and easy

Categories: Markdown  Tags: hackmd onlineservice 

Rendering Math Formulas in Markdown with MathJax and KaTeX

Displaying math formulas in Markdown

Depending on the theme, math rendering may already work out of the box, but if the formulas do not show up, add the following to layout/partial/footer.html inside the theme Copy <script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]} }); </script> <script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML"></script> KaTeX can be used to generate complex math formulas server-side. $$ \phi = \frac{(1+\sqrt{5})}{2} = 1.6180339887\cdots $$ Additional details can be found on GitHub or on the Wiki . [Read More]
Categories: markdown  Tags: example 

Markdown Sample

Sample MarkDown formatting

Advertisement :) pica - high quality and fast image resize in browser. babelfish - developer friendly i18n with plurals support and easy syntax. You will like those projects! h1 Heading 8-) h2 Heading h3 Heading h4 Heading h5 Heading h6 Heading Horizontal Rules Typographic replacements Enable typographer option to see result. (c) (C) (r) (R) (tm) (TM) (p) (P) +- test.. test… test….. test?….. test!…. !!!!!! ???? ,, – — [Read More]
Categories: markdown  Tags: example 

Mermaid Diagram Samples in Hugo

Creating sequence diagrams in Markdown

In Beautifulhugo, the Hugo theme, mermaid.js, the library for drawing sequence diagrams, is already built in, so simply specifying the short tag and writing in the mermaid format is enough to display a sequence diagram. If it is not built into your theme, it is a good idea to refer to the article Hugoにmermaidを組み込んでみた (in Japanese). A simple sample graph LR A[Local] -->|git push| B(GitLab.com) B --> C{Netlify} Gantt chart Quoted from the official site gantt dateFormat YYYY-MM-DD title Adding GANTT diagram functionality to mermaid section A section Completed task :done, des1, 2014-01-06,2014-01-08 Active task :active, des2, 2014-01-09, 3d Future task : des3, after des2, 5d Future task2 : des4, after des3, 5d section Critical tasks Completed task in the critical line :crit, done, 2014-01-06,24h Implement parser and jison :crit, done, after des1, 2d Create tests for parser :crit, active, 3d Future task in critical line :crit, 5d Create tests for renderer :2d Add to mermaid :1d [Read More]
Categories: Hugo  Tags: mermaid example beautifulhugo 

My First Post on Hugo with GitLab and Netlify

Notes on building my first Hugo site

I tried building a site using Hugo, GitLab and Netlify Building the site Prerequisites A GitLab account is already registered A Netlify account is already registered hugo is already installed locally Steps Create a repository on GitLab git clone it locally Create a new site with hugo Copy the directories and files created in 3. into the directory from 2. Create .gitignore Copy .DS_Store public Install the theme Copy $ git submodule add https://github.com/halogenica/beautifulhugo.git beautifulhugo The theme has been decided in advance, so copy it under the root [Read More]
Categories: Hugo  Tags: beautifulhugo 

Big Image Sample

Using Multiple Images

The image banners at the top of the page are refered to as “bigimg” in this theme. They are optional, and one more more can be specified. If more than one is specified, the images rotate every 10 seconds. In the front matter, bigimgs are specified using an array of hashes. [Read More]
Tags: example bigimg